Name: Anonymous 2011-10-12 14:21
In OZ there is a function called map, which allows you to manipulate each member of a list and create a new list.
This will add one to each element of the list and create a new one. Which would leave me with
[2 3 4 5 6]
I am trying to do something where I compare each element of the list to a Key and then print it if it matches, else nil.
I can't figure a way to get the variable Key into the anonymous function, as it will just declare a new instance. Is there a way to do this easily? Or am I trying to do this the wrong way.
Map [1 2 3 4 5] fun {$ X} [X+1] endThis will add one to each element of the list and create a new one. Which would leave me with
[2 3 4 5 6]
I am trying to do something where I compare each element of the list to a Key and then print it if it matches, else nil.
I can't figure a way to get the variable Key into the anonymous function, as it will just declare a new instance. Is there a way to do this easily? Or am I trying to do this the wrong way.