Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'functions and slots and map' topicStudent Support Forum > General > Archives > "functions and slots and map"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'functions and slots and map')
Author Date Posted
functions and slots and map david silver... 01/29/01 1:33pm
Re: functions and slots and map Forum Modera... 01/29/01 1:56pm
Next Comment >Help | Reply To Topic