Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question on Map or Apply

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66369] Re: Question on Map or Apply
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 11 May 2006 02:14:20 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <e3sgbh$ln9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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.

Hi Lector,

Try

In[1]:=
lst = {{{2006, 1, 16}, {2006, 3, 31}},
     {{2006, 1, 24}, {2006, 3, 31}},
     {{2005, 6, 17}, {2006, 3, 31}}};

In[2]:=
Needs["Miscellaneous`Calendar`"]

In[3]:=
(DaysBetween[#1[[1]], #1[[2]]] & ) /@ lst

Out[3]=
{74, 66, 287}

Best regards,
Jean-Marc


  • Prev by Date: Re: Creating a new table using values from a column in another table,
  • Next by Date: Re: Mathematica Question
  • Previous by thread: Re: Question on Map or Apply
  • Next by thread: RE: Question on Map or Apply