Skip to content

Instantly share code, notes, and snippets.

@razetime
Last active October 21, 2022 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razetime/48a98ea35f65c5db4390b525e35cd0ff to your computer and use it in GitHub Desktop.
Save razetime/48a98ea35f65c5db4390b525e35cd0ff to your computer and use it in GitHub Desktop.
APL spec

The language, all names, characters, and incidents portrayed in this production are fictitious. No identification with actual languages (living or deceased), places, buildings, and products is intended or should be inferred.

The language is called APL (asinine programming language), and it will be on the esolangs wiki under APL (esolang), probably mentioned under APL (disambiguation).

Functions are defined using ∇name (⍵,⍺) <stuff here> .. the (⍵,⍺) portion will always remain the same and cannot be changed. Only two arguments can be given to a function. All assignments are by reference.

Primitives

Primitives have random precedence that changes every time the program is run(you need a ton of parentheses).

  • equality
  • + add pointers together
  • - subtract the pointer of a var from another
  • × dereference a pointer
  • ÷ add two numbers
  • * multiply
  • root/square root
  • rotate/open file and return tie number
  • ! boolean not
  • ? generate a deterministic number, multiple deterministic numbers. Must be same every single time program is run
  • | draw a line on the screen
  • ⌈⌊ (digraph) get range of an array (max-min)
  • ⊥⊤ (digraph) is the argument truthy
  • ⊢⊣ (digraph) reverse array
  • = assignment
  • unassignment: if a variable contains the value on the right it is removed
  • same as
  • < same as
  • > identity function
  • identity function but with a bar
  • create a stack from array, add to stack
  • pop from stack, return
  • print version info
  • play tringular wave sound
  • version info (verbose)
  • play triangular+sine wave
  • move one line up
  • move one line down
  • ⊂⊃ (digraph) link two arrays together
  • head and tail of array
  • remove half the elements of an array and then enclose it
  • create a bst from array
  • convert bst to sorted array
  • iterate n times
  • while loop
  • evolve: convert array of pairs to a dict. there are no other operations on dicts however
  • convert dict to array of pairs
  • symbol that is equal to everything
  • symbol that equals nothing
  • ~ bitwise not, join
  • /\ (digraph) boolean and
  • \/ (digraph) boolean or
  • ⌿⍀ (digraph) boolean nand
  • ⍀⌿ (digraph) boolean nor
  • , end program
  • end program with error code
  • print
  • convert from dollars to cents
  • convert from degrees to radians
  • cut an array into two halves
  • ¨ index into array
  • bitwise nor
  • e^index into array
  • . end function
  • concatenate
  • concatenate with join element
  • concatenate and store in register V
  • @ convert decimal to percentage rounded to the nearest unit
  • enclose
  • decimal to binarystring
  • binarystring to decimal
  • putting this at the end of a line concats the next line to the current line
  • open among us
  • ⍵⍺ reserved for functions
  • reboot system
  • ¯ negate a number
  • zero, 0 is not allowed in APL source code and will cause a syntax error
  • {} both are NOPs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment