]> gitweb.factorcode.org Git - factor-unmaintained.git/blobdiff - sto/sto.factor
unmaintained: New home for misfit Factor vocabularies.
[factor-unmaintained.git] / sto / sto.factor
diff --git a/sto/sto.factor b/sto/sto.factor
new file mode 100644 (file)
index 0000000..b43c9cc
--- /dev/null
@@ -0,0 +1,20 @@
+
+USING: kernel lexer parser words quotations compiler.units ;
+
+IN: sto
+
+! Use 'sto' to bind a value on the stack to a word.
+!
+! Example:
+!
+!   10 sto A
+
+: sto
+  \ 1quotation parsed
+  scan
+    current-vocab create
+    dup set-word
+  literalize parsed
+  \ swap parsed
+  [ define ] parsed
+  \ with-compilation-unit parsed ;                              parsing