]> gitweb.factorcode.org Git - factor.git/commitdiff
memoize: use unsafe words.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 17 Jul 2012 23:24:30 +0000 (16:24 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 17 Jul 2012 23:24:30 +0000 (16:24 -0700)
basis/memoize/memoize.factor

index 1817cf83a919f67d9ed5d780dea3ac0a13e40847..71580257dd13bdc8061f7b407b5eb67123d6128a 100644 (file)
@@ -15,7 +15,7 @@ IN: memoize
 : [nsequence] ( length exemplar -- quot )
     [ [ [ 1 - ] keep ] dip '[ _ _ _ new-sequence ] ]
     [ drop [ [ set-nth-unsafe ] 2keep [ 1 - ] dip ] (n*quot) ] 2bi
-    [ nip ] 3append ; 
+    [ nip ] 3append ;
 
 : [firstn] ( length -- quot )
     [ 0 swap ] swap
@@ -29,7 +29,7 @@ IN: memoize
 
 : unpacker ( seq -- quot )
     length dup 4 <=
-    [ { [ drop ] [ ] [ first2 ] [ first3 ] [ first4 ] } nth ]
+    [ { [ drop ] [ ] [ first2-unsafe ] [ first3-unsafe ] [ first4-unsafe ] } nth ]
     [ [firstn] ] if ;
 
 : pack/unpack ( quot effect -- newquot )