Skip to content

Instantly share code, notes, and snippets.

@Radvylf
Created May 25, 2022 03:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Radvylf/b8dd14834a0ef519238e0b9076807a76 to your computer and use it in GitHub Desktop.
Save Radvylf/b8dd14834a0ef519238e0b9076807a76 to your computer and use it in GitHub Desktop.

rSNBATWPL built-in reference

  • $: Dyadic, calls first arg as a function with second arg as its arg (yo dawg...)
  • =: Assign to a variable or ID
  • ,: Array builder, sometimes acts a bit silly, a bit wacky
  • ~: Function builder, arg on left and body on right
  • id: Makes an ID from a variable
  • nscopd-id: Makes an unscoped ID from a variable
  • var: Dereferences a variable (useful with strings)
  • ncon: Wraps something in an array
  • cast.*: Casts to a float, int, string, bool, or array
  • con: Pushes second arg to the end of the first (not the same as conc)
  • conc: Concats two arrays
  • +: Addition, concat, bool OR
  • -: Subtraction, bool XOR
  • *: Multiplication, repeat, bool AND
  • /: Division
  • %: Modulo
  • **: Exponentiation/power, cartesian product
  • cmp: Compare
  • </>/<=/>=: Tf do you think they do it's 22:29 I'm not writing a useful explanantion you slimy cur
  • and: Non-short-circuiting AND
  • or: Non-short-circuiting OR
  • ~~: Loose equality (sort of is)
  • ==: Strict equality (is)
  • !~/!: Loose inquality (sort of is not)
  • !=/!!: Strict inequality (is not)
  • +=/-=/*=//=/%=: Do I have to explain everything to you?
  • ++/--: Increment/decrement
  • _: Negate, reverse, bool NOT
  • @: Dereferences IDs
  • if: It's like your favorite practical language, but with an odd twist: It still runs the code if the condition fails, but as a ghost, and returns the result if it had run whether it did or not
  • (prints): Contains stuff to be printed (INTERNAL)
  • print: Prints something
  • (inputs): Contains stuff to be inputed (INTERNAL)
  • input: Inputs something
  • .is-partial: Returns how many args a built-in has already taken
  • cond: Takes a condition. Returns result of second arg is truthy, third arg if falsy
  • size: Length of a string or array, doesn't matter
  • car: First item from an array, if you use this instead of {0}, you're a nerd, you know that?
  • cdr: All but first item in an array
  • copy: Clones something (this may behave very oddly with functions and IDs)
  • isdo: Casts to bool. Literally all it does. What do you want from me?
  • isdon't: Like isdo, but from another universe made of antimatter. Falls in love with isdo at the end of the movie, but when they embrace one another, the resulting particle annihilation flattens New York
  • isn: Is null? Is null?!
  • isnn't: isdon't's cousin who thinks the whole antimatter thing is a conspiracy and that it doesn't really need to stay away from real matter
  • ?: Identity
  • type: Type, as a string (nb: floats are number)
  • not: Same as isdon't
  • dbg: Debug command
  • dbg.data: Gets rid of the fluff. You're not here to mess around. You're a serious guy, with serious business to attend to.
  • dbg.pars: Literally the only thing that we can rely on in this cruel world (unless there's a trailing apostrophe)
  • while: Classic while loop
  • do-while: Same order as a while loop, just runs the body once first
  • for: C-style for loop, note that you can put multiple final statements in if you have a lot of unfinished business
  • There's a ton of math operators, like sin and min, and constants like PI and SQRT2
  • strfor: Map. No reason you'd ever use this.
  • filt: Filter
  • find: Find array item matching predicate
  • findpos: Like find but returns the first index
  • findposs: Returns all of the indices, not to be outdone.
  • rdc: Reduce
  • rdcr: Reduce (from right)
  • sort: Sort with a comparator (tip: sort> and sort< for ascending and descending, sort cmp if you're not as misanthropic as me)
  • norm: Normalizes a string. No reason this should be there, it's never going to be useful, but Unicode is hell so I'll give you this one for free
  • points: Extracts a list of code points from a string
  • from-points: Makes a string from a list of code points
  • sto: Slice to an index
  • sfro: Slice from an index
  • flip: Transpose
  • rvr: Reverse
  • split: Split a string or array
  • squish: Shallow flat an array
  • crush: Deep flat an array
  • squish-with: Shallow flat an array, joining with a delimiter
  • crush-with: Deep flat an array, joining with a delimiter

Future features:

  • nscopd-fn: Unscoped functions? What would that even do, you silly man?
  • sentinel: You'll have to wait and find out
  • macro: Yep, runtime macros. They're worse than you could possibly imagine.
  • NullParsingCall: Redefining null is a readability issue in some contexts, this gives you more flexibility
  • dbg.scop: 1.1 will come with a ton of stuff regarding scope manipulation, so far this is a known function that will be added
  • scop: Extracts the scope from a scopd function or id
  • src: Takes the source from a function, and makes it into a new data type: source code. Code is finally data!
  • built-in: Allows constructing built-ins
  • splat: Splats an array into a function's args and [REDACTED}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment