Category:Quackery: Difference between revisions
Content added Content deleted
(Added description.) |
(Added description.) |
||
Line 8: | Line 8: | ||
The Quackery GitHub repository, which includes the Quackery manual "The Book of Quackery" as a pdf, is at [https://github.com/GordonCharlton/Quackery github.com/GordonCharlton/Quackery]. |
The Quackery GitHub repository, which includes the Quackery manual "The Book of Quackery" as a pdf, is at [https://github.com/GordonCharlton/Quackery github.com/GordonCharlton/Quackery]. |
||
== About Quackery == |
|||
The Quackiverse consists of operators (i.e. op-codes or "primitives"), numbers (BigInteger) and nests (dynamic arrays of operators, numbers and nests). They reside on two stacks, or in one of the two dictionaries of named items (operators, numbers and nests) that the Quackery compiler, <code>build</code>, uses to translate written Quackscript into nests that can be evaluated with <code>do</code>or added to other of the dictionaries. |
|||
<pre> [ build do ] is quackery</pre> |
|||
Quackery in a nutshell. |
|||
To compile this definition of <code>quackery</code>, <code>build</code> 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 <code>build</code> and <code>do</code>, in that order. Quackery code is evaluated from left to right, one item after another, traversing a tree of nests in depth first order. Once <code>build</code> 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 <code>do</code> for evaluation. The second stack, the return stack, manages <code>do</code>'s depth first traversal of nested nests. |
|||
The words <code>is</code>, <code>[</code>, and <code>]</code> are builders; they can be found in the builders dictionary, which extends the functionality of <code>build</code> beyond building a flat nest for <code>do</code> to evaluate. <code>is</code> takes the item that <code>do</code> most recently added to its output nest, and adds it to the names dictionary, along with the string that follows it, "<code>quackery</code>" 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 <code>builds</code> is equivalent to <code>is</code> 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. <code>done</code> causes <code>do</code>to stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. <code>again</code> restarts the evaluation of that nest, non-recursively. The word <code>recurse</code> does it recursively. <code>if</code> and <code>iff</code> conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. <code>else</code> skips over one item, unconditionally. As with the other provided control flow operators, these words are nests, not operators, that make use of the "meta-control 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 <code>do</code> does a number, the behaviour of the number is to put its numerical value on the stack. Operators do the heavy lifting, treating numbers as integers, or as booleans, or as sequences of bits, or as characters, or editing nests, interfacing with the real-world host computer for I/O, and suchlike. 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 co-processor that intermediates, that takes care of the nests and bignums, providing pointers to the Quackery engine CPU on request, and garbage collecting continuously. |
Revision as of 23:03, 23 April 2022
Quackery
This programming language may be used to instruct a computer to perform a task.
Listed below are all of the tasks on Rosetta Code which have been solved using Quackery.
This programming language may be used to instruct a computer to perform a task.
See Also: |
|
---|
Quackery is an implementation of Quackery.
Other implementations of 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 about 50k of Pythonscript, 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.
Pages in category "Quackery"
The following 200 pages are in this category, out of 704 total.
(previous page) (next page)N
- Non-decimal radices/Input
- Non-decimal radices/Output
- 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 base-16 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
- Pseudo-random numbers/Middle-square method
- Pseudo-random 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
- Rep-string
- 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
- Rock-paper-scissors
- Roman numerals/Decode
- Roman numerals/Encode
- Rot-13
- Round-robin tournament schedule
- RPG attributes generator
- Run-length encoding
- Runtime evaluation
- Ruth-Aaron numbers
S
- Safe and Sophie Germain primes
- Sattolo cycle
- SEDOLs
- Selectively replace multiple instances of a character within a string
- Self-describing numbers
- Self-hosting compiler
- Semiprime
- Semordnilap
- Sequence of non-squares
- 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 right-adjacent bits
- Set, the card game
- Seven-sided dice from five-sided dice
- Sexy primes
- Shell one-liner
- Shift list elements to left by 3
- Short-circuit 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 prime-digital sequence
- Smith numbers
- Snake and ladder
- Soloway's recurring rainfall
- Solve the no connection puzzle
- 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
- Stair-climbing puzzle
- Start from a main routine