From 19b5eb602e53c652519eadfd784924bb18ad3ae9 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Thu, 18 Jun 2009 21:02:29 -0300 Subject: [PATCH] tokyo.assoc-functor: Fix >alist and delete-at --- extra/tokyo/assoc-functor/assoc-functor.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/tokyo/assoc-functor/assoc-functor.factor b/extra/tokyo/assoc-functor/assoc-functor.factor index 30debfc934..1df1325eef 100644 --- a/extra/tokyo/assoc-functor/assoc-functor.factor +++ b/extra/tokyo/assoc-functor/assoc-functor.factor @@ -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 ;