more fixes

cvs
Slava Pestov 2004-08-04 00:21:43 +00:00
parent 8d5ffb360b
commit 076dd4fa43
1 changed files with 4 additions and 1 deletions

View File

@ -56,8 +56,11 @@ USE: stack
#! [ [ 1 | "one" ] [ 2 | "two" ] [ 3 | "three" ] ] #! [ [ 1 | "one" ] [ 2 | "two" ] [ 3 | "three" ] ]
assoc* dup [ cdr ] when ; assoc* dup [ cdr ] when ;
: acons ( value key alist -- alist )
>r swons r> cons ;
: set-assoc ( value key alist -- alist ) : set-assoc ( value key alist -- alist )
#! Sets the key in the alist. Does not modify the existing #! Sets the key in the alist. Does not modify the existing
#! list by consing a new key/value pair onto the alist. The #! list by consing a new key/value pair onto the alist. The
#! newly-added pair 'shadows' the previous value. #! newly-added pair 'shadows' the previous value.
>r swons r> [ dupd car= not ] subset cons ; [ dupd car = not ] subset acons ;