Handbook
Glossary
create-word ( name vocab -- word )
Factor handbook
»
The language
»
Words
»
Word introspection
»
Looking up and creating words
Next:
create-word-in ( str -- word )
Vocabulary
words
Inputs
name
a
string
vocab
a
string
Outputs
word
a
word
Word description
Creates a new word. If the vocabulary already contains a word with the requested name, outputs the existing word. The vocabulary must exist already; if it does not, you must call
create-vocab
first.
Notes
This word must be called from inside
with-compilation-unit
. Parsing words should call
create-word-in
instead of this word.
Definition
USING:
definitions
kernel
vocabs
;
IN:
words
:
create-word
( name vocab -- word )
check-create
2dup
lookup-word
[
2nip
]
[
vocab-name
<word>
dup
reveal
dup
changed-definition
]
if*
;