Open rebolek opened 3 years ago
How do you see it working? Maps are unordered, so the key you want to remove has to be implicit somehow.
Related R3's request: https://www.curecode.org/rebol3/ticket.rsp?id=806 @greggirwin maybe working like this:
>> remove-each [key val] #(a 1 "b" 2 c #[none] d: 3) [any [string? key none? val]]
== #(
a: 1
d: 3
)
in the same way how is possible to do:
>> foreach [key val] #(a 1 "b" 2 c #[none] d: 3) [print [key "is" val]]
a is 1
b is 2
c is none
d is 3
I'm happy for people to play with it and comment.
remove-each_map: func ['word [block!] data [map!] body [block!]][
foreach [key val] data [
if do body [remove/key data key]
]
data
]
The R/S today doesn't use the words when remove-each-next
call is made, so we'd need a map!
version of that. I don't see where remove-each-init
is called at all in the code base. @dockimbel is that dead code now?
Thanks @Oldes that's exactly what I meant.
foreach
supportsmap!
howeverremove-each
does not and for bulk key removalforeach
+remove/key
combo must be used.