Re: Generate #s

*To*: mathgroup at smc.vnet.net*Subject*: [mg111012] Re: Generate #s*From*: magma <maderri2 at gmail.com>*Date*: Fri, 16 Jul 2010 07:00:14 -0400 (EDT)*References*: <i1p823$pj9$1@smc.vnet.net>

On Jul 16, 11:16 am, Francisco Gutierrez <fgutiers2... at yahoo.com> wrote: > 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? If i understand your question.... it seems you just forgot to put the &, which must appear somewhere after all. example = {1, 5, 7, 9} (* list of parts *) arg = {w, e, r, t, y, u, i, o, p} (*an argument with 9 parts*) Table[#[[example[[ii]]]], {ii, 1, Length[example]}] &[arg] will give you {w, y, i, p} that is: a list of the first, fifth, seventh and ninth part of the argument