Modules
This documents the certain modules in Jolf. For readability, each space will be replaced by an underscore. Use a space when coding.
Prototype module
These are constructed as (space)(character)(this)(arguments)
.
String prototypes
_F(string)(function)
- foreach overstring
char-by-char withfunction
._E(string)
- String replace. (NOTE: Useρ
to save a byte.)_i(string)(thing)
-string.indexOf(thing)
._h(string1)(string2)
- regex search forstring2
instring1
; returns true if the string is found._s(string)(thing)
- searchesstring
forthing
; literallystring.search(thing)
._l(string)(bottom)(top)
- slicesstring
frombottom
totop
;string.slice(bottom,top)
._L(string)(index)
-string.slice(index)
._S(string)(function)
- mapsstring
withfunction
._m(string)(regex as string)(flags OR "g")
- matchesstring
according to theregex
andflags
;string.match(new RegExp(m,o||"g"))
._M(string)(regex as string)(flags)
-_m
, but with mandatory flags._r(string)
- trims string (removes leading and trailing whitespace)._R(string)
- reverses string. (NOTE: Use_(string)
, with a literal underscore, to save a byte.)_`(string)(index)
- theindex
th character instring
.
Array prototypes
_e(array)(function)
- checks if every value inarray
"satisfies"function
. (Array.every
.)_f(array)(function)
- filter array._F(array)(function)
- array foreach._h(array)(element)
- membership in array._i(array)(thing)
- indexof thing in array._r(array)
- random element._R(array)
- reverse. (NOTE: use_(array)
(literal underscore) to reverse an array.)_p(array)
- pops element from array. (NOTE: useΧ
(uppercase Chi) to pop an element from an array.)_s(array)
- shifts element from array. (NOTE: useχ
(lowercase Chi) to shift an element from an array.)_S(array)
- shuffles an array._l
and_L
- slice an array with 2 and 1 arguments, respectively._m(array)(thing)
- ifthing
is a function, function map. Otherwise, tries usingthing
as jolf then regular JS code. Otherwise, tries to pawn you off to another language._`(array)(value)
- fillarray
withvalue
.
mathjs module
Called with !
+ char
.
\x01
-getData
\x02
-imagToArray
\x03
-displayImg
-
abs
!
-acos
"
-acosh
#
-acot
$
-acoth
%
-acsc
&
-acsch
'
-add
(
-and
)
-arg
*
-asec
+
-asech
,
-asin
-
-asinh
.
-atan
/
-atan2
0
-atanh
1
-bellNumbers
2
-bignumber
3
-bitAnd
4
-bitNot
5
-bitOr
6
-eval
7
-bool
8
-catalan
9
-cbrt
:
-ceil
;
-chain
<
-clone
=
-combinations
>
-compare
?
-compile
@
-complex
A
-composition
B
-concat
C
-conj
D
-cos
E
-cosh
F
-cot
G
-coth
H
-cross
I
-csc
J
-csch
K
-cube
L
-deepEqual
M
-det
N
-diag
O
-distance
P
-divide
Q
-dot
R
-dotDivide
S
-dotMultiply
T
-dotPow
U
-equal
V
-compile
W
-exp
X
-eye
Y
-factorial
Z
-filter
[
-fix
\
-permutations
]
-floor
^
-forEach
_
-format
`
-fraction
a
-pow
b
-gcd
c
-help
d
-print
e
-im
f
-index
g
-intersect
h
-inv
i
-isInteger
j
-isNegative
k
-isNumeric
l
-isPositive
m
-isZero
n
-kldivergence
o
-larger
p
-largerEq
q
-lcm
r
-leftShift
s
-log
t
-undefined
u
-undefined
v
-lsolve
w
-lup
x
-bitXor
y
-map
z
-matrix
{
-max
|
-mean
}
-median
~
-min
-
mod
£
-multiply
¦
-nthRoot
§
-number
¨
-ones
©
-or
«
-parser
¬
-partitionSelect
-prod
°
- unassigned±
- unassigned²
-range
³
-re
·
-round
»
-sin
½
-size
ͺ
-parse
΄
- unassigned΅
-rightArithShift
Ά
-rightLogShift
Έ
-sec
Ή
-sech
Ί
-sign
Ό
-sinh
Ύ
-slu
Ώ
-smaller
ΐ
-smallerEq
Α
-sort
Β
-sparse
Γ
-sqrt
Δ
-square
Ε
-squeeze
Ζ
-std
Η
-stirlingS2
Θ
-string
Ι
-subset
Κ
-subtract
Λ
-sum
Μ
-tan
Ν
-tanh
Ξ
-to
Ο
-trace
Π
-transpose
Ρ
-_typeof
-unaryMinus
Σ
-unaryPlus
Τ
-unequal
Υ
-unit
Φ
-usolve
Χ
-variance
Ψ
-xgcd
Ω
-xor
Ϊ
-zeros
―
-c
‘
-mode
’
-multinomial
€
-norm
₯
-not
Array Z
module
These are called Z<char>
in the program. Currently an incomplete list.
a
(Za<numA><numB>
) - makes an array filled withnumA
of lengthnumB
. Literally,Zb*[J]j
(ifJ = numA
andj = numB
).A
(ZA<num>
) - makes a zero array of lengthnum
. Compare toZa0<num>
andZb*[0]j
.b
(Zb<array>
) - returns the big union of the array, i.e., flattening the array.B
(ZB<arrayA><arrayB>
) - returns the intersection of two arrays.c
(Zc<array><num>
) - returnsarray
chopped into subarrays of lengthnum
. For example,Zc[1,2,3,4,5]2
yields[[1,2],[3,4],[5]]
.C
(ZC<array>
) - returns the cumulative summation ofarray
. For example,ZC[1,2,3,4,5]
yields[1,1+2,1+2+3,1+2+3+4,1+2+3+4+5] = [1,3,6,10,15]
.d
(Zd<array>
) - returns the differences between the indices ofarray
. For example,Zd[1,5,2,3]
yields[4,-3,1]
.D
(ZD<str>
) - convertsstr
into an array of digts.e
(Ze<array><num>
) - returns all entries of lengthnum
inarray
.E
(ZE<array><num>
) - returns all entries not of lengthnum
inarray
.f
(Zf<array>
) - flattens an array.F
(ZF<array><num>
) - flattens an array, but only to a certain depthnum
.g
(Zg<array>
) - returns cumulative product onarray
. SeeZC
.G
(ZG<array><func><num>
) - cumulatively reducesarray
over the functionfunc
with a starting pointnum
.h
(Zh<any>
) - returns "all but the last entry of"any
. (For a number, it chops of the last digit.)H
(ZH<any>
) - returns "all but the first of"any
. CompareZh
.i
(Zi<str>
) - returnsstr
s lines, but reversed and joined.I
- unassignedj
(Zj<any><num>
) - returns "all but the lastN
" ofany
. CompareZh
.J
(ZJ<any><num>
) - returns "all but the firstN
" ofany
. CompareZh
.k
(Zk<array>
) - returns the minimal element ofarray
.K
(ZK<array>
) - returns the maximal element ofarray
. (TBA)