{ $description "Creates a new symbol for every token until the " { $snippet ";" } "." }
{ $examples { $example "USING: prettyprint ;" "IN: scratchpad" "SYMBOLS: foo bar baz ;\nfoo . bar . baz ." "foo\nbar\nbaz" } } ;
+HELP: INITIALIZE:
+{ $syntax "INITIALIZE: word ... ;" }
+{ $description "If " { $snippet "word" } " does not have a value in the global namespace, calls the definition and assigns the result to " { $snippet "word" } " in the global namespace." }
+{ $examples
+ { $unchecked-example
+ "USING: math namespaces prettyprint ;"
+ "SYMBOL: foo"
+ "INITIALIZE: foo 15 sq ;"
+ "foo get-global ."
+ "225" }
+ { $unchecked-example
+ "USING: math namespaces prettyprint ;"
+ "SYMBOL: foo"
+ "1234 foo set-global"
+ "INITIALIZE: foo 15 sq ;"
+ "foo get-global ."
+ "1234" }
+} ;
+
HELP: SINGLETON:
{ $syntax "SINGLETON: class" }
{ $values
";" [ create-word-in [ reset-generic ] [ define-symbol ] bi ] each-token
] define-core-syntax
+ "INITIALIZE:" [
+ scan-word parse-definition [ initialize ] 2curry append!
+ ] define-core-syntax
+
"SINGLETONS:" [
";" [ create-class-in define-singleton-class ] each-token
] define-core-syntax