This works for your particular task:

    { "1" "2" "3" } [
        { "a" "b" "c" } [ append ] with map " " join print
    ] each


On Sun, Aug 21, 2011 at 12:49 PM, Arkady Rost <[email protected]> wrote:

> Hi! I'm looking for a more elegant solution of the following task.
>
> for i in rangeA {
>     for j in rangeB {
>         foo(param, i, j);
>     }
>     bar();
> }
>
> I need to translate this to factor.
>
> foo(param, y, x) <=> x y param foo
>
> I have a solution:
> rangeA rangeB param [ foo ] curry [ swapd [ call ] 2curry each bar ] 2curry
> each
>
> For example,
> rangeA = { "a" "b" "c" }
> rangeB = { "1" "2" "3" }
> param = " "
> foo = append append write ;
> bar = "" print ;
>
> { "a" "b" "c" } { "1" "2" "3" }  " " [ append append write ] curry [ swapd
> [ call ] 2curry each "" print ] 2curry each
>
> Result is :
> 1a 2a 3a
> 1b 2b 3b
> 1c 2c 3c
>
> I think my solution is bloated with partial applications. Maybe someone can
> provide a better way to solve this task.
>
> Cheers,
>     Ark. Rost
>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to