2005-01-29 14:18:28 -05:00
|
|
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
|
|
|
IN: words USING: kernel math namespaces strings unparser ;
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-11-03 23:35:36 -05:00
|
|
|
SYMBOL: gensym-count
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-11-03 23:35:36 -05:00
|
|
|
: (gensym) ( -- name )
|
|
|
|
"G:" global [
|
2004-12-29 03:35:46 -05:00
|
|
|
gensym-count [ 1 + dup ] change
|
2004-11-03 23:35:36 -05:00
|
|
|
] bind unparse cat2 ;
|
2004-09-02 16:40:34 -04:00
|
|
|
|
2004-11-03 23:35:36 -05:00
|
|
|
: gensym ( -- word )
|
|
|
|
#! Return a word that is distinct from every other word, and
|
|
|
|
#! is not contained in any vocabulary.
|
|
|
|
(gensym) f (create) ;
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-11-03 23:35:36 -05:00
|
|
|
global [ 0 gensym-count set ] bind
|