]> gitweb.factorcode.org Git - factor.git/commitdiff
Add 'extra/sto'
authorEduardo Cavazos <dharmatech@finkelstein.stackeffects.info>
Thu, 4 Dec 2008 19:10:19 +0000 (13:10 -0600)
committerEduardo Cavazos <dharmatech@finkelstein.stackeffects.info>
Thu, 4 Dec 2008 19:10:19 +0000 (13:10 -0600)
extra/sto/sto.factor [new file with mode: 0644]

diff --git a/extra/sto/sto.factor b/extra/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