List of position-specifying functions
- To: mathgroup at smc.vnet.net
- Subject: [mg102351] List of position-specifying functions
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 6 Aug 2009 06:32:16 -0400 (EDT)
I have a list of distinct positive integers, such as In[1]:= plist = {2, 5, 4, 6, 3}; I want to convert it to a list of position-specifying functions, such as might be used as the second argument in SplitBy or GatherBy. One way that works is: In[2]:= plist /. p_Integer->(#[[p]]&) Out[2]= { #1[[2]]&, #1[[5]]&, #1[[4]]&, #1[[6]]&, #1[[3]]& } I've been trying to get the same thing using Map, but I haven't been able to do it. Any suggestions?
- Follow-Ups:
- Re: List of position-specifying functions
- From: "Elton Kurt TeKolste" <tekolste@fastmail.us>
- Re: List of position-specifying functions
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: List of position-specifying functions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: List of position-specifying functions
- From: Adriano Pascoletti <adriano.pascoletti@dimi.uniud.it>
- Re: List of position-specifying functions
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: List of position-specifying functions