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: [mg71804] Re: Short, simple - Why doesn't it work as a function
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Wed, 29 Nov 2006 02:56:56 -0500 (EST)
  • References: <ekh7e4$sd0$1@smc.vnet.net>

Clear["Global`*"]

why[x_List] := ({#1, a} & ) /@ x

why[{a, b, c}]
{{a, a}, {b, a}, {c, a}}


Regards
Dimitris

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.
> 
> I've checked the FullForms and they are different - why??


  • Prev by Date: Re: Short, simple - Why doesn't it work as a function
  • Next by Date: Re: Short, simple - Why doesn't it work as a function
  • 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