Well, here's three versions for inspiration.

1) Given a 'foo' quotation that takes elements from each and prints it out:

    : foo ( a b foo: ( x y -- z ) -- )
        [ with map " " join print ] 2curry each ; inline

    ( scratchpad ) { "1" "2" "3" } { "a" "b" "c" }
                   [ append ] foo

2) Given a 'foo' and a 'bar' that acts on the resulting sequence from
'foo'ing:

    : bar ( a b foo: ( x y -- z ) bar: ( z -- ) -- )
        [ [ with map ] 2curry ] dip compose each ; inline

    ( scratchpad ) { "1" "2" "3" } { "a" "b" "c" }
                   [ append ] [ " " join print ] bar

3) Taking version #2 and rewriting with fry quotations:

    USE: fry

    : bar ( a b foo: ( x y -- z ) bar: ( z -- ) -- )
        '[ _ with map @ ] curry each ; inline



On Sun, Aug 21, 2011 at 1:13 PM, Arkady Rost <arkr...@gmail.com> wrote:

> The original task is more complicated that's why I've used foo and bar in
> definition of the problem. Thanks for attention but I'm looking for a better
> solution in the general case.
>
>
> ------------------------------------------------------------------------------
> 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
> Factor-talk@lists.sourceforge.net
> 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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to