Functions - Steven-Hewitt/LI GitHub Wiki
2. List of functions
Each function noted here is one character, followed by the accepted parameters in parenthesis, followed by a dash -
and its use. As this is a preliminary list, objects are subject to change.
I should note which of these are currently implemented: Those that are implemented have their explanations bolded.
-
*...*
- values (returns the values it was given as multiple arguments, in order to extend arity of certain functions) -
a
(pair) - car (aka first) -
b
(any*...) - build list -
c
(any any) - cons -
C
(int) - cast to character -
C
(list) - Combination of 2 (in order) -
d
(pair) - cdr (aka rest) -
d
(int) - digits (returns list of single numbers) -
D
(list) - duplicate (mλh*chhi) -
e
(string any) - eval w/ input (explicit string literal/expression needed) -
E
(string) - eval (implicit i as input) -
f
(list) - flatten -
f
(number) - floor (casts to int) -
F
(func list*...) - foldl -
g
(func) - force execution (executes the function with its arguments even when the function literal would have been returned) -
G
(func) - force function literal -
h
(int) - halve -
i
- input variable (implicitly fills end of string if extra parameters are needed) -
I
(list) - condense (returns a number that contains the numbers from the list's digits in the same order) -
j
- returns the input variable for implicit inner lambdas -
l
() - empty list -
L
(i*func)- lambda -
m
(func list*...) - map -
M
(number number*...) - multiply -
M
(list list) - Cartesian product (list of lists) -
M
(list number) - Repetition -
n
(number) - random number between 0 and argument (float) -
N
(int) - random integer between 0 and argument -
p
(int) - primality (returns boolean) -
P
(any) - print-return (as p in Pyth) -
q
() - quine (returns the source code for the top-level λ) -
r
(string string) - regex match (returns truthy regresult if matched, or false if not) -
r
(list int) - value at int position in list (because of implicit casting, works for strings as well) -
R
(any*...) - recurse (call current lambda function with these parameters. If more than one argument, implicit build-list the arguments.) -
s
(list func*func) - sort (list sorted by func which takes two arguments and outputs truthy falsy value, may have two functions in which case the second one outputs a key to use) -
S
(string string) - split arg2 on arg1 -
T
() - current time (as a list of year, month, day, hours, minutes, seconds) -
u
(*...) - null (always returns no value and is equal to no value) -
U
(list any) - search (returns first list index that contains the second parameter or boolean "False") -
V
(number) - Variations of "Hello World" -
w
(number) - wait argument milliseconds -
W
() - current weekday (integer from0
to6
) -
X
(int) - range (0
toint - 1
) -
y
(number) - decrement -
Y
(number) - increment -
z
(sequence integer) - first integer values from the given sequence -
+
(number number*...) - sum -
+
(list list*...) - append -
.
(any) - duplicate (.x is equivalent to *xx*) -
:
(any) - triplicate (:x is equivalent to *xxx*) -
,
(list) - params from list -
-
(number number*...) - difference -
_
(boolean) - negate* -
_
(list) - empty? -
_
(number) - zero? -
=
(any any) - equal? -
/
(number number*...) - divide -
/
(list list) - intersection -
/
(number list) - n-step -
%
(number number) - modulus -
^
(number number) - power -
&
(bool bool*...) - and -
|
(bool bool*...) - or -
$
(regresult string) - regex replace (returns original string if regresult is falsy) -
#
(list) - length -
!
(integer) - factorial -
!
(list (of list)) - transpose -
[
(list*...) - any -
]
(list*...) - all -
{
(any list*...) - in -
}
(any list*...) - not in -
>
(number number) - greater than -
>
(string string) - greater than (length, then character-by-character) -
>
(number string) - greater than (implicit length) -
<
(number number) - lesser than -
<
(string string) - lesser than (length, then character-by-character) -
<
(number string) - lesser than (implicit length) -
)
(func list (of list)*...) - maximum-map-from-list -
(
(func list (of list)*...) - minimum-map-from-list -
~
(list) - reverse -
~
(int) - invert (equivalent to-0
) -
\
(*) - character literal -
"..."
- string literal (" for double quotes inside strings and other escape sequences are as usual. Implicitly ends string if needed) -
'...'
- number literal (longer than one digit) -
?
(boolean any any) - if-else -
@
(any any) - if-else with implied input as boolean. -
0
(...) - always returns 0 -
1
(...) - always returns 1 -
2
(...) - always returns 2 -
3
(...) - always returns 3 -
4
(...) - always returns 4 -
5
(...) - always returns 5 -
6
(...) - always returns 6 -
7
(...) - always returns 7 -
8
(...) - always returns 8 -
9
(...) - always returns 9