On Wed, Apr 23, 2008 at 2:17 PM, Jean-François Bigot
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I needed to get the list of all combinaisons of n elements chosen in
> a sequence.
Does this do what you needed?
: combos ( seq -- seqs )
dup empty? [ drop { { } } ]
[
unclip
[ combos dup ]
[ [ prefix ] curry map append ] bi*
] if ;
( scratchpad ) { 1 2 3 } combos .
{ { } { 3 } { 2 } { 2 3 } { 1 } { 1 3 } { 1 2 } { 1 2 3 } }
--
Eric Mertens
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk