MathGroup Archive 2010

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

Search the Archive

Re: List to Expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106092] Re: List to Expression
  • From: dh <dh at metrohm.com>
  • Date: Fri, 1 Jan 2010 05:35:15 -0500 (EST)
  • References: <hhhmm7$o90$1@smc.vnet.net>

Hi,
you may e.g.use Fold to achieve this:

ll = Reverse@Flatten@l;
Fold[#2[#1] &, First[ll], Rest[ll]]

Daniel

On 31 Dez., 09:17, Spell <l_shar... at hotmail.com> wrote:
> Hellp,
>
> I am having trouble converting a list into an "expression". For example suppose I have the following list expression.
>    l = {a, {b, {c, d}}}
>
> When I evaluate the FullForm version, I get an output with List as the Head.
>  List[a,List[b,List[c,d]]]
>
> But, I would like the following output instead: a[b[c,d]], wondering how this would be accomplised.
>
> PS:
> Essentially, I have a FunctionSet with various functions in it. And would like to generate a tree of functions, from the FunctionSet. So, say I have functions from a to d in the set. Then, I can generate something like: d[a[b], c[d[a[b]]].
>
> Thank you.



  • Prev by Date: overimpose graphics on an imported image
  • Next by Date: Database Challenge
  • Previous by thread: Re: overimpose graphics on an imported image
  • Next by thread: Re: List to Expression