]> gitweb.factorcode.org Git - factor.git/commitdiff
tokyo.assoc-functor: Fix >alist and delete-at
authorBruno Deferrari <utizoc@gmail.com>
Fri, 19 Jun 2009 00:02:29 +0000 (21:02 -0300)
committerBruno Deferrari <utizoc@gmail.com>
Fri, 19 Jun 2009 00:04:38 +0000 (21:04 -0300)
extra/tokyo/assoc-functor/assoc-functor.factor

index 30debfc934d675a01063e16860f92fa3a132a7fc..1df1325eefa61a2ad308628a910969c5a8b6c580 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Bruno Deferrari
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types arrays assocs destructors functors
+USING: accessors alien.c-types arrays assocs destructors fry functors
 kernel locals sequences serialize tokyo.alien.tcutil tokyo.utils vectors ;
 IN: tokyo.assoc-functor
 
@@ -42,13 +42,13 @@ M: TYPE assoc-size ( db -- size ) handle>> DBRNUM ;
     ] while 3drop ;
 
 M: TYPE >alist ( db -- alist )
-    dup DBKEYS [ over at 2array ] with nip ;
+    [ DBKEYS dup ] keep '[ dup _ at 2array ] change-each ;
 
 M: TYPE set-at ( value key db -- )
     handle>> spin [ object>bytes dup length ] bi@ DBPUT drop ;
 
 M: TYPE delete-at ( key db -- )
-    handle>> [ object>bytes dup length ] DBOUT drop ;
+    handle>> swap object>bytes dup length DBOUT drop ;
 
 M: TYPE clear-assoc ( db -- ) handle>> DBVANISH drop ;