Category:Quackery
This programming language may be used to instruct a computer to perform a task.
See Also: 


Quackery is an opensource, lightweight, entrylevel concatenative language for educational and recreational programming.
It is coded as a Python 3 function in under 48k of Pythonscript, about half of which is a string of Quackery code.
The Quackery GitHub repository, which includes the Quackery manual "The Book of Quackery" as a pdf, is at github.com/GordonCharlton/Quackery.
About Quackery
The Quackiverse consists of operators (i.e. opcodes or "primitives"), numbers (BigInteger) and nests (dynamic arrays of operators, numbers and nests). They reside on either of two stacks, or in one of the two dictionaries of named items (operators, numbers and nests) that the Quackery compiler, build
, uses to translate written Quackscript into nests that can be evaluated with do
, the default behaviour, or added to either of the dictionaries.
[ build do ] is quackery
Quackery in a nutshell.
To compile this definition of quackery
, build
takes a string of Quackscript and turns it into a nest. The left and right brackets delimit a nest, which will contain pointers to the dictionary items called build
and do
, in that order. Quackery code is evaluated from left to right, one item after another, traversing a tree of nests in depthfirst order. Once build
has compiled the string, it passes the resultant nest via the Quackery stack, which is used to carry arguments and results from one word to the next, to do
for evaluation. The second stack, the return stack, manages do
's depthfirst traversal of nested nests.
The words is
, [
, and ]
are builders; they can be found in the builders dictionary, which extends the functionality of build
beyond building a flat nest for do
to evaluate. is
takes the item that do
most recently added to its output nest, and adds it to the names dictionary, along with the string that follows it, "quackery
" as its name. The syntax of Quackery is; words and numbers are sequences of printable characters, separated by spaces and carriage returns unless a builder treats the text that follows it otherwise. The builder builds
is equivalent to is
for adding new words and behaviours to the builders dictionary.
Evaluation of a nest proceeds from left to right unless a control flow operator redirects it. done
causes do
to stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. again
restarts the evaluation of that nest, nonrecursively. The word recurse
does it recursively. if
and iff
conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. else
skips over one item, unconditionally. As with the other provided control flow operators, these words are nests, not operators, that make use of the "metacontrol flow" operators, which grant the behaviours described above to words that use them. (They modify items on the return stack, rather than acting on the Quackery engine's various pointers registers directly, so their changes are enacted upon exiting the nest that called them.)
There are no variables in Quackery. Instead, there are stack management words to rearrange the uppermost items on the Quackery stack as required, and nameable ancillary stacks that fulfil the roles of variables.
Everything is code except when it is data. When do
does a number, the behaviour of the number is to put its numerical value on the stack. Operators do the heavy lifting; there are operators that treat numbers as integers, or as booleans, or as sequences of bits, or as characters, and there are operators to edit nests, interface with the realworld host computer for I/O, and so on. Nests give structure to code and data alike.
Conceptually, the Quackery engine is a stack based processor which does not have direct access to physical memory but has a memory management coprocessor that intermediates, that takes care of the nests and bignums, provides pointers to the Quackery engine CPU on request, and garbage collects continuously.
Quackery is not intended to be a superfast enterpriselevel language; it is intended as a fun programming project straight out of a textbook. (The textbook is included in the download.)
If your language supports bignums, firstclass functions and dynamic arrays of bignums, functions and dynamic arrays, and has automatic garbage collection, and if you can code depthfirst traversal of a tree you can implement Quackery in your preferred language with reasonable ease, and modify it as you please.
Or try your hand at one of the Tasks not implemented in Quackery.
Pages in category "Quackery"
The following 200 pages are in this category, out of 700 total.
(previous page) (next page)N
 Number names
 Number reversal game
 Numbers divisible by their individual digits, but not by the product of their digits.
 Numbers in base 10 that are palindromic in bases 2, 4, and 16
 Numbers in base16 representation that cannot be written with decimal digits
 Numbers which are not the sum of distinct squares
 Numbers which are the cube roots of the product of their proper divisors
 Numbers whose binary and ternary digit sums are prime
 Numbers whose count of divisors is prime
 Numbers with equal rises and falls
 Numbers with prime digits whose sum is 13
 Numbers with same digit set in base 10 and base 16
 Numeric separator syntax
O
P
 Padovan sequence
 Pairs with common factors
 Palindrome dates
 Palindrome detection
 Palindromic primes
 Palindromic primes in base 16
 Pandigital prime
 Pangram checker
 Parsing/RPN calculator algorithm
 Partial function application
 Partition function P
 Pascal's triangle
 Peano curve
 Pell numbers
 Penney's game
 Pentagram
 Perfect numbers
 Perfect shuffle
 Perfect totient numbers
 Periodic table
 Permutations
 Permutations by swapping
 Permutations with repetitions
 Permutations with some identical elements
 Permutations/Derangements
 Permutations/Rank of a permutation
 Permuted multiples
 Pernicious numbers
 Phrase reversals
 Pi
 Pick random element
 Pierpont primes
 Pig the dice game
 Pinstripe/Display
 Piprimes
 Pisano period
 Playing cards
 Polyspiral
 Population count
 Positive decimal integers with the digit 1 occurring exactly twice
 Power set
 Price fraction
 Primality by trial division
 Primality by Wilson's theorem
 Prime decomposition
 Prime numbers p for which the sum of primes less than or equal to p is prime
 Prime numbers which contain 123
 Prime triplets
 Prime words
 Primes which contain only one odd digit
 Primes whose sum of digits is 25
 Primorial numbers
 Print itself
 Priority queue
 Probabilistic choice
 Product of divisors
 Product of min and max prime factors
 Program termination
 Proper divisors
 Pseudorandom numbers/Middlesquare method
 Pseudorandom numbers/Splitmix64
 Pythagorean triples
R
 Random Latin squares
 Random number generator (included)
 Rare numbers
 Read entire file
 Recaman's sequence
 Remove duplicate elements
 Remove vowels from a string
 Rename a file
 Repstring
 Repeat
 Repeat a string
 Repunit primes
 Return multiple values
 Reverse a string
 Reverse the order of lines in a text file while preserving the contents of each line
 Reverse words in a string
 Riordan numbers
 Rockpaperscissors
 Roman numerals/Decode
 Roman numerals/Encode
 Rot13
 Roundrobin tournament schedule
 RPG attributes generator
 Runlength encoding
 Runtime evaluation
 RuthAaron numbers
S
 Safe and Sophie Germain primes
 Sattolo cycle
 SEDOLs
 Selectively replace multiple instances of a character within a string
 Selfdescribing numbers
 Selfhosting compiler
 Semiprime
 Semordnilap
 Sequence of nonsquares
 Sequence of primes by trial division
 Sequence: smallest number greater than previous term with exactly n divisors
 Sequence: smallest number with exactly n divisors
 Set
 Set consolidation
 Set puzzle
 Set rightadjacent bits
 Set, the card game
 Sevensided dice from fivesided dice
 Sexy primes
 Shell oneliner
 Shift list elements to left by 3
 Shortcircuit evaluation
 Show ASCII table
 Show the (decimal) value of a number of 1s appended with a 3, then squared
 Sierpinski arrowhead curve
 Sierpinski carpet
 Sierpinski curve
 Sierpinski pentagon
 Sierpinski square curve
 Sierpinski triangle
 Sierpinski triangle/Graphical
 Sieve of Eratosthenes
 Simple turtle graphics
 Sleeping Beauty problem
 Smallest multiple
 Smallest numbers
 Smallest power of 6 whose decimal expansion contains n
 Smallest square that begins with n
 Smarandache primedigital sequence
 Smith numbers
 Snake and ladder
 Soloway's recurring rainfall
 Sort an integer array
 Sort disjoint sublist
 Sort numbers lexicographically
 Sort primes from list to a list
 Sort stability
 Sort the letters of string in alphabetical order
 Sort three variables
 Sort using a custom comparator
 Sorting algorithms/Bogosort
 Sorting algorithms/Bubble sort
 Sorting Algorithms/Circle Sort
 Sorting algorithms/Cocktail sort
 Sorting algorithms/Cocktail sort with shifting bounds
 Sorting algorithms/Counting sort
 Sorting algorithms/Gnome sort
 Sorting algorithms/Heapsort
 Sorting algorithms/Insertion sort
 Sorting algorithms/Merge sort
 Sorting algorithms/Pancake sort
 Sorting algorithms/Patience sort
 Sorting algorithms/Permutation sort
 Sorting algorithms/Quicksort
 Sorting algorithms/Radix sort
 Sorting algorithms/Selection sort
 Sorting algorithms/Stooge sort
 Sorting algorithms/Strand sort
 Special characters
 Special divisors
 Special factorials
 Special variables
 Speech synthesis
 Spelling of ordinal numbers
 Spiral matrix
 Split a character string based on change of character
 Square but not cube
 Stack
 Stack traces
 Stairclimbing puzzle
 Start from a main routine
 Steady squares
 Stemandleaf plot
 SternBrocot sequence