Skip to content

Instantly share code, notes, and snippets.

@Steffan153
Last active September 7, 2022 03:50
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 Steffan153/dfdb9b60def5a109c5770b4a7da7968b to your computer and use it in GitHub Desktop.
Save Steffan153/dfdb9b60def5a109c5770b4a7da7968b to your computer and use it in GitHub Desktop.
  • +: add two numbers, or concatenate
  • -: subtract
  • *: multiply or repeat a string n times
  • /: divide
  • %: modulus
  • e: exponent
  • N: negate or lowercase
  • ;: pair, [a, b]
  • D: remove first element or n - 2 for num
  • : reverse
  • : remove all occurences of something
  • C: concatenate
  • Ċ: binomial coefficient
  • Д: double
  • P: divisors or prefixes
  • O: ord/chr
  • :: first n items of string or list
  • Π: factorial or product
  • : sum
  • : permutations
  • : powerset
  • B: binary string
  • =: equal (vectorizes)
  • Q: equal (does not vectorize)
  • ċ: contains
  • : range [1, a]
  • Ȯ: range [1, a)
  • Ż: range [0, a)
  • : range [0, a]
  • : interleave
  • : transliterate
  • : First item; head
  • : join by newlines
  • ȯ: overlapping elements of size n
  • _: contextual input
  • #G: gridify
  • #s: suffixes
  • #i: infinite list of positive integers
  • #I: infinite list of all integers: [0, 1, -1, 2, -2, ...]
  • #Ḟ: infinite fibonacci
  • #P: infinite primes
  • #f: nth fibonacci
  • c1: constant [1, 1]
  • ca: lowercase alphabet
  • cA: uppercase alphabet
  • cz: lowercase alphabet reversed
  • cZ: uppercase alphabet reversed
  • cb: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • cy: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
  • cc: bcdfghjklmnpqrstvwxyz
  • : bcdfghjklmnpqrstvwxz
  • cv: aeiou
  • cṽ: aeiouy
  • cV: `AEIOU"
  • cṿ: aeiouAEIOU

Modifiers:

  • G: given a function, return a monad with takes intiial value and generates an infinite list
  • : swap args or min-by.
  • ¤: next two as monad
  • ¢: next three as monad
  • ¦: next four as monad
  • ¥: next two as dyad
  • ©: next three as dyad
  • §: next four as dyad
  • : each. vectorizes over the first vector, or if there is no vector, the first argument.
  • δ: right-each. vectorizes over the last vector, or if there is no vector, the last argument. given a monad, max-by.
  • ß: monadify a dyad by repeating the argument, or given a monad, sort-by.
  • /: reduce a list by a function, or if given a nilad n, consumes a function after that and reduces all chunks of size n by the function. so /2+ adds all chunks of size 2 in the array given.
  • ω: apply function over all overlapping pairs of list, or given a nilad n, gets all overlapping lists of size n and reduces the function over each

Syntax:

  • 'a: one-char string
  • "...": string literal
  • any of 0123456789.: number literal
  • ##: one-line comment
  • #{: open multi-line comment, closed by }#. nestable
  • }: close some structure that is open (map, list, etc.)
  • [: open a list literal, closed by }: [1 2 3}
  • γ: map over a list, closed by }. so γ...} acts the same as a monadic operator, use it just like any other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment