Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Callisto
  • Cat
  • Cognate
  • colorForth
  • Concata
  • CoSy
  • Deque
  • DSSP
  • dt
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Fiveth
  • Forth
  • Fourth
  • Freelang
  • Gershwin
  • hex
  • iNet
  • Joy
  • Joy of Postfix App
  • kcats
  • Kitten
  • lang5
  • Listack
  • LSE64
  • Lviv
  • Meow5
  • min
  • Mirth
  • mjoy
  • Mlatu
  • Ode
  • OForth
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Prowl
  • Quest32
  • Quackery
  • r3
  • Raven
  • Retro
  • RPL
  • SPL
  • Staapl
  • Stabel
  • Tal
  • Titan
  • Trith
  • Uiua
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Concatenative topics

  • Compilers
  • Interpreters
  • Type systems
  • Object systems
  • Quotations
  • Variables
  • Garbage collection
  • Example programs

Concatenative meta

  • People
  • Communities

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Meta

  • Search
  • Farkup wiki format
  • Etiquette
  • Sandbox

Quackery

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

Examples of Quackery code

Naive Recursive Fibonacci

  [ dup  2 < if done
    dup  1 - recurse
    swap 2 - recurse + ]        is fibonacci    (       n --> n       )

Insertion Sort

  [ ]'[ 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-quotein sortwith sort would be defined as [ ' > sortwith ] is sort)

A Quackery Quine

[ this unbuild $ " is quine" join quackery ]

This nest creates a Quackery word called quine that creates a copy of itself.

  1. this -- put a copy of the nest it is in (a nest is items bounded by [ and ]) on the stack.
  2. unbuild -- decompile the item on the top of stack.
  3. $ " is quine" -- put the string literal " is quine" on the top of stack.
  4. join -- concatenate top two items.
  5. quackery -- compile and evaluate ToS. (quackery is defined as [ build do ] is quackery)

This revision created on Sat, 5 Dec 2020 01:30:49 by GordonCharlton (added some explanatory text to the examples)

Latest Revisions Edit

All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.