]> gitweb.factorcode.org Git - factor.git/commitdiff
assocs: cleanup and use first2-unsafe in assoc-find.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 6 Mar 2013 04:42:15 +0000 (20:42 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 6 Mar 2013 04:42:15 +0000 (20:42 -0800)
core/assocs/assocs.factor

index 4eeeb617e086e8791bd46cb9db595ae15757b0ec..6f296ab5b39657ae277592f46b974275018bce1c 100644 (file)
@@ -50,7 +50,7 @@ M: assoc assoc-like drop ; inline
 PRIVATE>
 
 : assoc-find ( ... assoc quot: ( ... key value -- ... ? ) -- ... key value ? )
-    (assoc-each) find swap [ first2 t ] [ drop f f f ] if ; inline
+    (assoc-each) find swap [ first2-unsafe t ] [ drop f f f ] if ; inline
 
 : key? ( key assoc -- ? ) at* nip ; inline
 
@@ -58,7 +58,7 @@ PRIVATE>
     (assoc-each) each ; inline
 
 : assoc>map ( ... assoc quot: ( ... key value -- ... elt ) exemplar -- ... seq )
-    [ >alist ] 2dip [ [ first2 ] prepose ] dip map-as ; inline
+    [ (assoc-each) ] dip map-as ; inline
 
 : assoc-map-as ( ... assoc quot: ( ... key value -- ... newkey newvalue ) exemplar -- ... newassoc )
     [ [ 2array ] compose { } assoc>map ] dip assoc-like ; inline