Other languages
Computer Science
Meta
Quackery is an open source, lightweight, entry level concatenative language for educational and recreational programming.
It is coded as a Python 3 function in under 48k of Pythonscript, half of which is a string of Quackery code.
The Quackery GitHub repository, which includes the Quackery manual The Book of Quackery in pdf form, is at http://sbcl.sourceforge.net The full code, examples, and The Book of Quackery are in the repository as quackery.zip.
The Quackery Facebook group is at https://www.facebook.com/groups/thequackerygroup
[ dup 2 < if done dup 1 - recurse swap 2 - recurse + ] is fibonacci ( n --> n )
[ ]'[ sort.test put [] swap witheach [ swap 2dup findwith [ over sort.test share do ] [ ] nip stuff ] sort.test release ] is sortwith ( [ --> [ ) [ sortwith > ] is sort ( [ --> [ )
(]'[
is called "meta-quote" - it grants the behaviour of '
("quote" to sortwith
as syntactic sugar. Without the meta-quote in sortwith
, sort
would be defined as [ ' > sortwith ] is sort
)
[ this unbuild $ " is quine" join quackery ]
This nest creates a Quackery word called quine that creates a copy of itself.
this
-- put a copy of the nest it is in (a nest is items bounded by [
and ]
) on the stack.unbuild
-- decompile the item on the top of stack.$ " is quine"
-- put the string literal " is quine" on the top of stack.join
-- concatenate top two items.quackery
-- compile and evaluate ToS. (quackery is defined as [ build do ] is quackery
)This revision created on Sat, 5 Dec 2020 01:32:14 by GordonCharlton (fixed typos)