MathGroup Archive 2010

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

Search the Archive

Re: Generate #s

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111032] Re: Generate #s
  • From: José Luis Gómez Muñoz <jose.luis.gomez at itesm.mx>
  • Date: Sat, 17 Jul 2010 08:18:02 -0400 (EDT)

I assume that you know that # has a special meaning in Mathematica (
arguments of pure functions, see
http://reference.wolfram.com/mathematica/ref/Slot.html ) and that you know
that the correct syntax for this meaning is #1, #5, #7, etc. and that
#[[1]],#[[2]], etc. is NOT correct, then you can generate your list with the
correct syntax with the following command:

Map[Slot, {1, 5, 7, 9}]

Or with this:

example={1,5,7,9}
Map[Slot,example]


HTH
Jose
Mexico


-----Mensaje original-----
De: Francisco Gutierrez [mailto:fgutiers2002 at yahoo.com] 
Enviado el: Viernes, 16 de Julio de 2010 04:16 a.m.
Para: mathgroup at smc.vnet.net
Asunto: [mg110988] Generate #s

Dear Group:
Suppose I have a list of ordered integers:
example={1,5,7,9}
Based on it, I want to generate a list of the form:
{#[[1]], #[[5]],#[[7]],#[[9]]}
 
I tested with simple things like:
Table[#[[example[[i]]]], {i,1,Length[example]}]
to no avail.
 
How can I do it?




  • Prev by Date: Re: MathLink error
  • Next by Date: parallel computing - obsolete functions?
  • Previous by thread: Re: Generate #s
  • Next by thread: Re: Generate #s