Set consolidation: Difference between revisions
Content added Content deleted
(Add Factor) |
(→{{header|Factor}}: Simplify.) |
||
Line 818: | Line 818: | ||
<lang factor>USING: arrays kernel sequences sets ; |
<lang factor>USING: arrays kernel sequences sets ; |
||
: comb ( x x -- x ) |
|||
⚫ | |||
⚫ | |||
: (comb) ( x x -- x ) |
|||
[ [ unclip ] dip union comb ] |
|||
⚫ | |||
[ [ 1 cut ] dip comb append ] if |
|||
] if ; |
|||
[ [ [ first 1array ] [ rest ] bi ] dip comb append ] if ; |
|||
⚫ | |||
: consolidate ( x -- x ) { } [ comb ] reduce ;</lang> |
: consolidate ( x -- x ) { } [ comb ] reduce ;</lang> |