Set consolidation: Difference between revisions

Content added Content deleted
(Added Quackery.)
m (→‎{{header|Quackery}}: simplified code)
Line 2,298: Line 2,298:
=={{header|Quackery}}==
=={{header|Quackery}}==


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


[ say "{" 0 swap
[ say "{" 0 swap
Line 2,305: Line 2,306:
[ 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
[ dup size 2 < if done
[ dup size 1 - times
[ dup size 1 - times
[ true temp put
[ behead over
behead over
witheach
witheach
[ 2dup & iff
[ 2dup & iff
[ | swap i^ poke
[ | swap i^ poke
false temp replace
[] conclude ]
conclude ]
else drop ]
else drop ]
temp take if join ] ] ] is consolidate ( [ --> [ )
join ] ] ] is consolidate ( [ --> [ )


[ dup witheach echoset
[ dup witheach echoset
say "--> "
say "--> "
consolidate witheach echoset
consolidate witheach echoset
cr ] is task ( [ --> )
cr ] is task ( [ --> )


$ "AB" ->set
$ "AB" ->set