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: Short, simple - Why doesn't it work as a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71787] Re: Short, simple - Why doesn't it work as a function
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Wed, 29 Nov 2006 02:56:29 -0500 (EST)

On 11/28/06 at 6:04 AM, wookiz at hotmail.com (wooks) wrote:

>{#, a} & /@ {a, b, c}

>gives {{a, a}, {b, a}, {c, a}} which is what i want.

>why[x_List] := {#, a} & /@ x; why[{a, b, c}]

>gives.

>{{a, a}, {{b, a}, {{c, a}, {}}}}

>not what I want.

That isn't what I get in a fresh session, i.e.

In[1]:=
why[x_]:={#,a}&/@x

In[2]:=
why[{a,b,c}]

Out[2]=
{{a, a}, {b, a}, {c, a}}

In[3]:=
$Version

Out[3]=
5.2 for Mac OS X (June 20, 2005)

--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Short, simple - Why doesn't it work as a function
  • Next by Date: Re: Re: Limit of Infinitely Nested Expression (4.0
  • Previous by thread: Re: Short, simple - Why doesn't it work as a function
  • Next by thread: Re: Short, simple - Why doesn't it work as a function