[REBOL] Removal or exclusion ?
From: patrick:philipot:laposte at: 7-Jul-2003 18:40
Hi list
In terms of elegance and efficiency, which one do you choose ? remove-each or exclude
? or a third solution ?
My problem is to remove all the selected items of a text-list from the list-data. I have
got two ways to do that:
(1) remove-each x list-data [found? find mylist/picked x]
(2) s-temp: exclude list-data mylist/picked clear list-data append list-data s-temp
Unfortunately, in this particular case, one cannot use "list-data: exclude list-data
mylist/picked" because the resulting block is not associated to the list anymore.
The test example...
list-data: ["red" "green" "blue" "yellow" "white"]
lay: layout [
mylist: text-list 200x200 data list-data
button "Remove selected" 200 [
; remove-each x list-data [found? find mylist/picked x]
s-temp: exclude list-data mylist/picked clear list-data append list-data s-temp
show mylist
]
]
view center-face lay
Regards
Patrick