Is there a clever Snap! way of doing this - apart from simply looping from item 2 to item (length) and deleting each item
edit - oops - forgot to mention that I don't want to use a set block as I don't want to disturb my watcher that I've setup
Is there a clever Snap! way of doing this - apart from simply looping from item 2 to item (length) and deleting each item
edit - oops - forgot to mention that I don't want to use a set block as I don't want to disturb my watcher that I've setup
list(item(1) of l)
cant you move the first item elsewhere, then clear the list, then add the first item back?
ig this is a bit simpler
Q:What is the quickest way of sorting the shuffle of numbers(1) to (n)?
A:Repopulating it takes O(n).
oops - forgot to mention that I don't want to use a set block as I don't want to disturb my watcher that I've setup
delete (numbers from 2 to length(x)) of x
That was what I tried first but it doesn't seem to work
oh right
"Delete all" seems to work and does not mess with watchers
nah
In this case, Dardoro's function is the best !
Last month, i wrote a function to delete a list of index in a list...
With this block, you can delete index 2 to length(list)...
(It use the for each block but it work with this case and other cases like delete records 1,7,3,last of the list)
Full project tutorial
the block:
I think it is an interesting block
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.