Re: doing things on a procedural way and doing them on a functional way

• To: mathgroup at smc.vnet.net
• Subject: [mg46976] Re: [mg46952] doing things on a procedural way and doing them on a functional way
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Thu, 18 Mar 2004 01:25:03 -0500 (EST)
• References: <200403170729.CAA16380@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I guess a little self-advertisement is not a major offence on this
list, so I suggest looking at my article in the forthcoming Mathematica
Journal. If you can't wait you or don't have a subscription you can

<http://www.mimuw.edu.pl/~akoz/Mathematica/AlgebraicProgramming.nb>

Andrzej Kozlowski

On 17 Mar 2004, at 08:29, Pedrito wrote:

> Hello Mathgroup!
>
>
> I wanted to figure how to obtain all the possible combinations of five
> numbers and four non-conmutative non-asociative operations.
>
> This means:
> if we have numbers: a b c d e
> and the non-conmutative non-asociative operation:  ?
>
> it's possible to make the following (different) expressions:
> a ? (b ? (c ? (d ? e)))
> a ? (b ? (c ? d) ? e))
> ...
> (a ? b) ? (c ? d) ? e
>
>
> For practical reasons you can think that the operation ? is ^ (power).
>
>
>
> I have already obtained (by hand) all the possible combinations:
>      lst={{a, {b, {c, {d, e}}}}, {a, {b, {{c, d}, e}}}, {a, {{b, c},
> {d,
> e}}}, {a, {{b, {c, d}}, e}}, {a, {{{b, c}, d}, e}}, {{a, b}, {c, {d,
> e}}},
> {{a, b}, {{c, d}, e}}, {{a, {b, c}}, {d, e}}, {{{a, b}, c}, {d, e}},
> {{a,
> {b, {c, d}}}, e}, {{a, {{b, c}, d}}, e}, {{{a, b}, {c, d}}, e}, {{{a,
> {b,
> c}}, d}, e}, {{{{a, b}, c}, d}, e}}
>
>     And then I transformed them into an expressions by:
> Module[{x = 1},
>       ToExpression[
>         StringReplace[
>           ToString[#1], {"{" -> "(", "}" -> ")",
>             "," :> {"^", "^", "^", "^"}\[LeftDoubleBracket]
>                 x++\[RightDoubleBracket]}]]] & /@ lst
>
>
> If you can help me to do it better...
>
>
> Pedro L.
>
>

```

• Prev by Date: Re: Mathematica 5: Integration bug in quadratic found by the GEMM machine
• Next by Date: Re: How to get non-printing heads?
• Previous by thread: doing things on a procedural way and doing them on a functional way
• Next by thread: Re: doing things on a procedural way and doing them on a functional way