I have a feeling this is a stupid question, but here it is anyway:
Suppose I have a collection of tuples.
Would it be possible to write anonymous function (x,y,…)->… where arguments are the tuple elements?
An example:
A = [ (x,y) for x=1:5, y=1:5 ]
I can extract and use the tuple elements directly in for loop:
for (x,y) in A
println(x,y)
end
For an anonymous function I can write something like:
filter(t -> t[1]==1 || t[2]==1, A)
but I feel I want to write this as:
filter((x,y) -> x==1 || y==1, A)