Ah, I see, multiple dispatch is the real cause. I'll have to live with the 
little ideosyncrasy, then.
Peter's idea filter(p -> +(p...)%4 != 0, pairs) works fine... in my simple 
example. In real life, I wanted to filter an array d of integers, with a 
predicate
i<=n && d[i]!=i && d[d[i]]==i, so filter((i,v)->i<=n && v!=i && 
d[v]==i,enumerate(d)) looked like a reasonable idea, it just doesn't work. 
We can make it work, though that looks a bit strange, too:
filter([e for e in enumerate(d)]) do x
       i,v=x
       i<=n && v!=i && d[v]==i       
       end
Here, it looks as if the function filter took only one argument. It works, 
however. In my code, I had to sum up the values of i after filtering, so I 
chose the obscure formulation
sum(map(first,filter(x->x[1]!=x[2] && x[2]<=n && 
d[x[2]]==x[1],enumerate(d))))

>
>>

Reply via email to