Re: Convert list into function
- To: mathgroup at smc.vnet.net
- Subject: [mg41554] Re: [mg41523] Convert list into function
- From: Amit Gandhi <akgandhi at uchicago.edu>
- Date: Mon, 26 May 2003 05:46:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Lets see
sounds to me what you want is:
FuncL[x_] := L[[x]];
FuncL defined in this fashion will output what you want
amit
On Saturday, May 24, 2003, at 12:05 AM, rbhatnagar wrote:
> Hi,
>
> A simple question: What is the correct way of converting a list into a
> function?
>
> For instance, lets say I have some list
> L = {1, 2, 3, 4}
>
> and I want a function such that FuncL[1] would return 1, FuncL[2] would
> return 2 and so on. So what is the syntax for FuncL?
>
> I need the function for some further manipulation in a situation in
> which
> simply using L[[1]] would not be appropriate.
>
> Thanks,
> R. Bhatnagar
>
>
>