Elf methods

NameDoc
_0Return 1st value of recipient.
_1Return 2nd value of recipient.
_2Return 3rd value of recipient.
absReturn the absolute value of recipient.
allpairsReturn all possible [A,B] lists where A and B are elements of recipient list.
atat(Key) Return value at key or nil if not present.
callCall recipient function with given arguments.
ceilReturn smallest integer that is greater than or equal to recipient.
condcond(Action1,...,ActionN, Else) Takes the first truthy value in recipient and runs the corresponding action or Else if no value is truthy. If Else is not specified, returns nil when no value is truthy.
contentsReturn contents of recipient file as string.
countcount(Fn) Count the number of values in recipient where Fn returns truthy.
debugPrint internal interpreter state.
decReturn the recipient decremented by 1.
digitReturn ASCII digit code as number, or nil if code is not a digit.
dodo(Fn) Call Fn on each value in recipient, presumably for side effects. For maps, Fn is called with key and value as arguments. Returns nil.
dropdrop(N) Return recipient without the first N values.
dropwdropw(Pred) Return items of recipient after the first Pred call on item returns falsy.
elseelse(V) Return recipient value if it is truthy, otherwise return V.
empty?True if recipient is nil, the empty list or an empty map.
ends?ends(Suffix) Returns true if recipient ends with Suffix, false otherwise.
evalEval recipient as elf code, returns the last value.
filterfilter(Fn) Call Fn on each value in recipient, return list of values where the result is truthy.
firstReturn first value in recipient.
floorReturn largest integer that is less than or equal to recipient.
fmtfmt(Arg1,...,ArgN) Format recipient string with given parameters, any use "%s" and "%d" to mark argument strings and numbers.
foldfold(Fn, Init) Call Fn with Init and first value of recipient, then with successive return values and values in recipient until all values are processed. If Init is omitted, nil is used.
groupgroup(Fn) Group values in recipient by Fn. Calls Fn on each value in recipient and returns map with the result as key and list of values having that result as value.
has?has?(Item) True if Item is member of recipient list, false otherwise.
headsReturn successive heads of recipient.
ifif(Then) If recipient is truthy, return Then. If Then is a function, it is called with the recipient as argument and its return value is returned.
ifif(Then,Else) If recipient is truthy, return Then otherwise return Else. Both can be values or functions.
in?in?(List) True if recipient is a member of List, false otherwise.
incReturn the recipient incremented by 1.
indexindex(Elt) Returns the first index of Elt in recipient list or -1 if it does not appear in the list.
joinjoin(Sep) Join recipient list of lists into one list with separator.
keepkeep(Fn) Call Fn on all values in recipient, returns list of all results that are not nil.
lastReturn last value in recipient.
lenReturns the length of a list.
linesReturn list of lines in file.
list?True if recipient is a list, false otherwise.
mapmap(Fn) Call Fn on all values in recipient and returns values as a list.
map?True if recipient is a map, false otherwise.
mapcatmapcat(Fn) Call Fn on all values in recipient appending all resulting lists in one list. Fn must return a list or nil.
matchmatch(Input) Parse input by matching it to specs in recipient list. Each spec can be a list expected at this position or a function that parses from the current position. Parsing function must return a parsed value and the rest of the list. Returns list of all non-nil values parsed by parsing functions.
maxReturn the maximum value of a list of numbers.
maxmax(Fn) Call Fn on each value in recipient, return the maximum value.
maxwmaxw(Fn) Call Fn on each value in recipient, return list containing the largest result and the value it corresponds with.
minReturn the minimum value of a list of numbers.
minmin(Fn) Call Fn on each value in recipient, return the minimum value.
minwminw(Fn) Call Fn on each value in recipient, return list containing the smallest result and the value it corresponds with.
nil?True if recipient is nil, false otherwise.
notReturn negated boolean of recipient.
nthnth(N) Return the Nth value in recipient.
number?True if recipient is a number, false otherwise.
numdigitsReturn the number of digits in a number, eg. 123 => 3
partpart(Size,[Skip]) Partition list into sublists of Size. If skip is omitted it is the same as Size. If skip is omitted, the last list may be shorter than the others if the input is not evenly sized. Example: [1,2,3,4] part(2,1) => [[1,2],[2,3],[3,4]]
powpow(N) Raise recipient to Nth power.
prPretty print recipient. Returns recipient.
printPrint value to standard output.
putput(Key1,Val1,...,KeyN,ValN) Put values into map, returns new map with added mappings.
readRead an Elf value (number, string, boolean or nil) from recipient string. Returns a list containing the read value and the rest of the string.
refCreate new mutable reference from recipient.
reverseReturn recipient reversed.
roundReturn the closest integer to recipient.
signReturn -1, 0 or 1 if recipient is negative, zero or positive respectively.
somesome(Pred) Returns the first value in recipient where the result of calling Pred on it returns truthy, or nil otherwise.
sortReturn recipient as sorted.
sortsort(Fn) Call Fn on each value in recipient, return recipient sorted by the return values.
sortuReturn recipient as sorted without duplicates.
splitsplit(Sep) split recipient list into sublists at each occurence of separator Sep.
splitwsplitw(Pred) Combines takew and dropw. Return list of [taken, dropped].
starts?starts?(Prefix) Returns true if recipient starts with Prefix, false otherwise.
strReturn readable representation of recipient as string.
sumReturns sum of all values in recipient.
swapswap(Fn,...Args) Update value of ref by calling Fn on its current value (and optional Args). Returns new value.
taketake(N) Return the first N values of recipient.
takewtakew(Pred) Return items of recipient list while calling Pred on item returns truthy.
toto(Upto) Return list of successive numbers from recipient to Upto.
toto(Upto, Skip) Return list of successive numbers from recipient to Upto, incrementing with Skip.
useLoad file denoted by recipient as elf code. All record types, methods and names defined in the file are available after this call.
valGet or set current value of mutable reference.
whilewhile(Then) Call recipient fn repeatedly while it returns a truthy value, call Then with that value.
wsParsing method to skip 0 or more whitespace characters. Returns [nil, rest] where rest is the string after the whitespace.