Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Picking from a part of list using pure function' topicStudent Support Forum > General > "Picking from a part of list using pure function"

Next Comment >Help | Reply To Topic
Author Comment/Response
Nors11
12/27/10 06:19am

Hi all,

list={{0,1},{1,1},{0,1},{1,0}};
l1={1,2,3,4};
l2={5,8,7,10};
i=1;
l=Pick[
Transpose[{l1, l2}][[i]], #, 1] & /@ list

This is the output:
{{5}, {1, 5}, {5}, {1}}

but i want in output:
{{5}, {2, 8}, {7}, {4}}

So i want at every step an i++.
So the first time it calls the function i must be 1, the second i=2, 3rd i=4 and so on.
But how to do that in a pure function?

Thanks

URL: ,

Subject (listing for 'Picking from a part of list using pure function')
Author Date Posted
Picking from a part of list using pure function Nors11 12/27/10 06:19am
Re: Picking from a part of list using pure func... toen 02/01/11 11:04am
Next Comment >Help | Reply To Topic