]> gitweb.factorcode.org Git - factor.git/commitdiff
memoize: fix invalidate-memoized for 0 args.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 19:04:56 +0000 (12:04 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 19:04:56 +0000 (12:04 -0700)
basis/memoize/memoize.factor

index 8750dfdd931a1c468597cabdb23e6b13021c6f63..a1d4da62dc485d43289ddd3adfb28e46c8454d0e 100644 (file)
@@ -91,6 +91,11 @@ M: memoized reset-word
     [ f swap set-first ] [ clear-assoc ] if ;
 
 : invalidate-memoized ( inputs... word -- )
-    [ stack-effect in>> packer call ] [ "memoize" word-prop delete-at ] bi ;
+    [ stack-effect in>> packer call ]
+    [
+        "memoize" word-prop dup sequence?
+        [ f swap set-first ] [ delete-at ] if
+    ]
+    bi ;
 
 \ invalidate-memoized t "no-compile" set-word-prop