Set consolidation: Difference between revisions

Content added Content deleted
(Add SETL)
(→‎{{header|Quackery}}: improved efficiency of algorithm)
Line 2,298: Line 2,298:
=={{header|Quackery}}==
=={{header|Quackery}}==


<syntaxhighlight lang="Quackery">
<syntaxhighlight lang="Quackery"> [ 0 swap witheach [ bit | ] ] is ->set ( $ --> { )
[ 0 swap witheach [ bit | ] ] is ->set ( $ --> { )


[ say "{" 0 swap
[ say "{" 0 swap
[ dup 0 != while
[ dup 0 != while
dup 1 & if
dup 1 & if [ over emit ]
[ over emit ]
1 >> dip 1+ again ]
1 >> dip 1+ again ]
2drop say "} " ] is echoset ( { --> )
2drop say "} " ] is echoset ( { --> )


[ dup size 2 < if done
[ [] swap
dup size 1 > while
[ dup size 1 - times
[ dup size 1 - times
[ behead over
[ behead over
Line 2,316: Line 2,315:
[] conclude ]
[] conclude ]
else drop ]
else drop ]
join ] ] ] is consolidate ( [ --> [ )
swap dip join ] ]
join ] is consolidate ( [ --> [ )


[ dup witheach echoset
[ dup witheach echoset
Line 2,338: Line 2,338:
$ "DB" ->set join
$ "DB" ->set join
$ "FGH" ->set join
$ "FGH" ->set join
task
task</syntaxhighlight>
task</syntaxhighlight>