Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Re: Understanding Flatten

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46317] Re: Understanding Flatten
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 14 Feb 2004 04:37:53 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 2/13/04 at 9:58 PM, Harold.Noffke at wpafb.af.mil (Harold Noffke)
wrote:

>In my study of Flatten, the Mathematica Book gives this example ...

>You can use Flatten to "splice" sequences of elements into lists or
>other expressions.

>In[5]:= Flatten[ {a, f[b, c], f[a, b, d]}, 1, f ]

>Out[5]= {a,b,c,a,b,d}

>I modified In[5] as follows ...

>In[1]:= Flatten[ { {a, f[b, c], f[a, b, d]}, {g, f[e, g]} }]

>Out[1]= {a, f[b, c], f[a, b, d], g, f[e, g]}

>I don't see why adding {g, f[e, g]} as a second list to the In[5]
>example unflattens Flatten's answer.  What am I misunderstanding?

You did more than just add {g, f[e, g]} to the end of the list to be flattened. You deleted the 2nd and 3rd arguments which told Flatten things with head f.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Need definitions for lhs=rhs
  • Next by Date: Re: C Code
  • Previous by thread: Re: Understanding Flatten
  • Next by thread: Re: Understanding Flatten