From: José Luis Gómez Muñoz on
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(a)yahoo.com]
Enviado el: Viernes, 16 de Julio de 2010 04:16 a.m.
Para: mathgroup(a)smc.vnet.net
Asunto: 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?



From: Bob Hanlon on
No, it was generated by Mathematica. It is TraditionalForm.

Array[x, 5]

{x(1),x(2),x(3),x(4),x(5)}

% // StandardForm

{x[1], x[2], x[3], x[4], x[5]}

% // TraditionalForm

{x(1),x(2),x(3),x(4),x(5)}


Bob Hanlon

---- David Bailey <dave(a)removedbailey.co.uk> wrote:

=============
On 16/07/10 12:00, Bob Hanlon wrote:
> data = Array[x, 10]
>
> {x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9),x(10)}
>
>

I guess you typed that in rather than generating it with Mathematica :)


In[2]:= data = Array[x, 10]

Out[2]= {x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10]}

David Bailey

http://www.dbaileyconsultancy.co.uk


From: Francisco Gutierrez on
Many thanks to Jos=E9 and other group members who sent me helpful ideas (as always) to solve my query.
Fg


--- On Sat, 7/17/10, Jos=E9 Luis G=F3mez Mu=F1oz <jose.luis.gomez(a)itesm.mx>wrote:


From: Jos=E9 Luis G=F3mez Mu=F1oz <jose.luis.gomez(a)itesm.mx>
Subject: Re: Generate #s
Date: Saturday, July 17, 2010, 7:18 AM


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(a)yahoo.com]
Enviado el: Viernes, 16 de Julio de 2010 04:16 a.m.
Para: mathgroup(a)smc.vnet.net
Asunto: 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?