how to calculate all of possible variants of expression?
Subject: how to calculate all of possible variants of expression?
From: Raymond Toy
Date: Wed, 18 Jul 2007 14:53:52 -0400
toter at mail.ru wrote:
> excuse me for my english :)
>
> for example I have something like that
> a:[1,2];
> b:[3,4];
>
> how to do so that c=a*b;
>
> must be ?=[3,4,6,8] (?=[1*3=3, 1*4=4, 2*3=6, 2*4=8])
Here is one way:
flatten(map(lambda([x],map(lambda([y],x*y),[3,4])),[1,2]));
There are probably better ways.
Ray