]> gitweb.factorcode.org Git - factor.git/commitdiff
lru-cache: initialize assoc with max-size.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 18 Mar 2021 18:32:16 +0000 (11:32 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 18 Mar 2021 18:32:16 +0000 (11:32 -0700)
extra/lru-cache/lru-cache.factor

index e7d82e2da1343d4ff3fb0ef0a12ec1e86995f792..ce2b7466da69dda25a101b40c17deee99a25a3d0 100644 (file)
@@ -9,7 +9,7 @@ IN: lru-cache
 TUPLE: lru-cache < linked-assoc max-size ;
 
 : <lru-cache> ( max-size exemplar -- assoc )
-    0 swap new-assoc <dlist> rot lru-cache boa ;
+    dupd new-assoc <dlist> rot lru-cache boa ;
 
 : <lru-hash> ( max-size -- assoc )
     H{ } <lru-cache> ;