assocs: improve stack effect for delete-at* and ?delete-at.
parent
00fc565111
commit
a861c4c732
|
@ -405,7 +405,7 @@ HELP: value?
|
||||||
{ $description "Tests if an assoc contains at least one key with the given value." } ;
|
{ $description "Tests if an assoc contains at least one key with the given value." } ;
|
||||||
|
|
||||||
HELP: delete-at*
|
HELP: delete-at*
|
||||||
{ $values { "key" "a key" } { "assoc" assoc } { "old" { $maybe "the previous value" } } { "?" boolean } }
|
{ $values { "key" "a key" } { "assoc" assoc } { "value/f" { $maybe "the previous value" } } { "?" boolean } }
|
||||||
{ $description "Removes an entry from the assoc and outputs the previous value together with a boolean indicating whether it was present." }
|
{ $description "Removes an entry from the assoc and outputs the previous value together with a boolean indicating whether it was present." }
|
||||||
{ $side-effects "assoc" } ;
|
{ $side-effects "assoc" } ;
|
||||||
|
|
||||||
|
|
|
@ -128,10 +128,10 @@ M: assoc keys [ drop ] { } assoc>map ;
|
||||||
|
|
||||||
M: assoc values [ nip ] { } assoc>map ;
|
M: assoc values [ nip ] { } assoc>map ;
|
||||||
|
|
||||||
: delete-at* ( key assoc -- old ? )
|
: delete-at* ( key assoc -- value/f ? )
|
||||||
[ at* ] 2keep delete-at ;
|
[ at* ] 2keep delete-at ;
|
||||||
|
|
||||||
: ?delete-at ( key assoc -- old ? )
|
: ?delete-at ( key assoc -- value/key ? )
|
||||||
[ ?at ] 2keep delete-at ;
|
[ ?at ] 2keep delete-at ;
|
||||||
|
|
||||||
: rename-at ( newkey key assoc -- )
|
: rename-at ( newkey key assoc -- )
|
||||||
|
|
Loading…
Reference in New Issue