Re: Question on Map or Apply
- To: mathgroup at smc.vnet.net
- Subject: [mg66380] Re: [mg66338] Question on Map or Apply
- From: János <janos.lobb at yale.edu>
- Date: Thu, 11 May 2006 02:15:13 -0400 (EDT)
- References: <200605101033.GAA21794@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On May 10, 2006, at 6:33 AM, LectorZ wrote: > Hi guys, > > I am trying to apply DaysBetween function to the following list: > > list={{{2006, 1, 16}, {2006, > 3, 31}}, {{2006, 1, 24}, {2006, 3, 31}}, {{2005, 6, 17}, {2006, > 3, 31}}} > > DaysBetween[list[[1, 1]], list[[1, 2]]] works well. > What I need is to apply DaysBetween on the whole list conaining 3 > sublists and getting a new list as a result containing 3 numbers. > > Thanks, > > LZ Here is a newbie approach using Map - /@ - : In[3]:= (DaysBetween[#1[[1]], #1[[2]]] & ) /@ list Out[3]= {74, 66, 287} János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)
- References:
- Question on Map or Apply
- From: "LectorZ" <lectorz@mail.ru>
- Question on Map or Apply