]> gitweb.factorcode.org Git - factor.git/commitdiff
memoize: moving MEMO[ to memoize.syntax to work around bootstrap issue.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 5 May 2012 05:24:21 +0000 (22:24 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 5 May 2012 05:24:21 +0000 (22:24 -0700)
basis/memoize/memoize-docs.factor
basis/memoize/memoize-tests.factor
basis/memoize/memoize.factor
basis/memoize/syntax/syntax-docs.factor [new file with mode: 0644]
basis/memoize/syntax/syntax-tests.factor [new file with mode: 0644]
basis/memoize/syntax/syntax.factor [new file with mode: 0644]

index 5365665f1f3fa0ecd5ee349f003b42b903059b33..426bd2916cf0106085733634a0b966007c8d702f 100644 (file)
@@ -26,8 +26,4 @@ HELP: MEMO:
 { $values { "word" "a new word to define" } { "definition" "a word definition" } }
 { $description "Defines the given word at parse time as one which memoizes its output given a particular input. The stack effect is mandatory." } ;
 
-HELP: MEMO[
-{ $syntax "MEMO[ elements... ]" }
-{ $description "Defines the given literal quotation as one which memoizes its outputs given a particular input." } ;
-
 { define-memoized POSTPONE: MEMO: } related-words
index 2ad14e8cec4c184a1d692598e63b378679c673c0..e89685263df3482bcb9e7d112ee9a17c49b42057 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2007, 2009 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: calendar math math.order kernel memoize tools.test parser
-generalizations prettyprint io.streams.string sequences eval
-namespaces see threads tools.time ;
+USING: math kernel memoize tools.test parser generalizations
+prettyprint io.streams.string sequences eval namespaces see ;
 IN: memoize.tests
 
 MEMO: fib ( m -- n )
@@ -34,9 +33,3 @@ unit-test
 [ sq ] ( a -- b ) memoize-quot "q" set
 
 [ 9 ] [ 3 "q" get call ] unit-test
-
-[ t ] [
-    { 1/8 1/8 1/8 1/8 1/16 1/16 1/16 }
-    [ MEMO[ seconds sleep ] each ] benchmark
-    0.18e9 0.25e9 between?
-] unit-test
index a595d5d3d965567bac8e1eb7f7dcfc7204e9ff9a..1817cf83a919f67d9ed5d780dea3ac0a13e40847 100644 (file)
@@ -2,8 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel hashtables sequences sequences.private arrays
 words namespaces make parser effects.parser math assocs effects
-definitions quotations summary accessors fry hashtables.identity
-stack-checker ;
+definitions quotations summary accessors fry hashtables.identity ;
 IN: memoize
 
 <PRIVATE
@@ -82,5 +81,3 @@ M: memoized reset-word
     [ stack-effect in>> packer call ] [ "memoize" word-prop delete-at ] bi ;
 
 \ invalidate-memoized t "no-compile" set-word-prop
-
-SYNTAX: MEMO[ parse-quotation dup infer memoize-quot suffix! ;
diff --git a/basis/memoize/syntax/syntax-docs.factor b/basis/memoize/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..d4eba04
--- /dev/null
@@ -0,0 +1,6 @@
+
+USING: help.markup help.syntax memoize.syntax ;
+
+HELP: MEMO[
+{ $syntax "MEMO[ elements... ]" }
+{ $description "Defines the given literal quotation as one which memoizes its outputs given a particular input." } ;
diff --git a/basis/memoize/syntax/syntax-tests.factor b/basis/memoize/syntax/syntax-tests.factor
new file mode 100644 (file)
index 0000000..4592c92
--- /dev/null
@@ -0,0 +1,10 @@
+USING: calendar math.order memoize.syntax sequences threads
+tools.test tools.time ;
+
+IN: memoize.syntax.tests
+
+[ t ] [
+    { 1/8 1/8 1/8 1/8 1/16 1/16 1/16 }
+    [ MEMO[ seconds sleep ] each ] benchmark
+    0.18e9 0.25e9 between?
+] unit-test
diff --git a/basis/memoize/syntax/syntax.factor b/basis/memoize/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..943f2c4
--- /dev/null
@@ -0,0 +1,6 @@
+USING: kernel memoize parser sequences stack-checker ;
+
+IN: memoize.syntax
+
+SYNTAX: MEMO[ parse-quotation dup infer memoize-quot suffix! ;
+