| Author |
Comment/Response |
david silverman
|
01/29/01 1:33pm
Hi,
I've been doing something like this to apply a built-in function to a list:
width=2;
p[x_]:=Partition[x,width];
data={{1,1,1,1},{2,2,2,2},{3,3,3,3},{4,4,4,4}};
data1=p/@data;
to get:
{{{1,1},{1,1}},{{2,2},{2,2}},{{3,3},{3,3}},{{4,4},{4,4}}}
Is there a way using functions and slots to do this more succinctly? I tried:
data1=Partition[#1,width]/@data;
and data1=Partition[#1&[data],width];
What's the correct way?
Thanks
URL: , |
|