This manual describes the complete overview of the palet scripting language.
Palet is an anagram-acronym of the words: (A)uto-(E)ditor's (T)iny (P)rocedural (L)anguage
Syntax
(define id expr)
Set id to the result of expr.
Syntax
(set! id expr)
Set the result of expr to id if id is already defined. If id is not defined, raise an error.
Syntax
(if test-expr then-expr else-expr)
Evaluates test-expr. If #t
then evaluate then-expr else evaluate else-expr. An error will be raised if evaluated test-expr is not a boolean?
.
Syntax
(when test-expr body)
Evaluates test-expr. If #t
then evaluate body else do nothing. An error will be raised if evaluated test-expr is not a boolean?
.
Syntax
(for ([id seq-expr] ...) body)
Loop over seq-expr by setting the variable id to the nth item of seq-expr and evaluating body.
Syntax
(for/vector ([id seq-expr] ...) body)
Like for
but returns a vector with the last evaluated elements of body
.
Returns #t
if v1 and v2 are the same type and have the same value, #f
otherwise.
Returns #t
if v1 and v2 refer to the same object in memory, #f
otherwise.
Returns #t
if v is #t
or #f
, #f
otherwise.
Value
true : boolean?
An alias for #t
.
Value
false : boolean?
An alias for #f
.
Returns #t
if v is a number, #f
otherwise.
Returns #t
if v is a real number, #f
otherwise.
Returns #t
if v is an integer, #f
otherwise.
Returns #t
if v is an integer and v is greater than -1
, #f
otherwise.
Returns #t
if v is equal to 0
, #f
otherwise.
Returns #t
if v is greater than 0
, #f
otherwise.
Returns #t
if v is less than 0
, #f
otherwise.
Return the sum of zs. Add from left to right. If no arguments are provided, the result is 0
.
When no ws are applied, return (- 0 z)
. Otherwise, return the subtraction of ws of z.
Return the product of zs. If no zs are supplied, the result is 1
.
When no ws are applied, return (/ 1 z)
. Otherwise, return the division of ws of z.
Return the modulo of n and m.
Clone of mod
.
Returns (+ z 1)
.
Returns (- z 1)
.
Returns #t
if all arguments are numerically equal, #f
otherwise.
Returns #t
if x is less than y, #f
otherwise.
Returns #t
if x is less than or equal to y, #f
otherwise.
Returns #t
if x is greater than y
, #f
otherwise.
Returns #t
if x is greater than or equal to y, #f
otherwise.
Returns the absolute value of x.
Returns largest value of the xs.
Returns smallest value of the xs.
Returns #t
if v is a vector, #f
otherwise.
Returns a new vector with the v args filled with its slots in order.
Returns a new vector with size slots, all filled with vs.
Remove the last element of vec and return it.
Append v to the end of vec.
Set slot pos of vec to v.
Append all elements of vec2 to the end of vec in order.
Returns #t
if v is an array, #f
otherwise.
Returns a freshly allocated array with dtype as its datatype and the v args as its values filled in order.
Procedure
(array-splice! arr v [start] [stop]) → array?
arr : array?
v : real?
start : integer? = 0
stop : integer? = (length arr)
Modify arr by setting start to stopto v.
Procedure
(margin left [right] arr) → bool-array?
left : integer?
right : integer? = left
arr : bool-array?
Returns a new bool-array?
with left andright margin applied.
Returns #t
if v is a pair, #f
otherwise.
Returns #t
if v is an empty list, #f
otherwise.
Returns a newly allocated pair where the first item is set to a and the second item set to d.
Returns the first element of the pair p.
Returns the second element of the pair p.
Returns #t
if v is an empty list or a pair whose second element is a list.
Returns a list with v in order.
Returns the element of lst at position pos.
Returns #t
if v is a range object, #f
otherwise.
Procedure
(in-range start stop [step]) → range?
start : integer?
stop : integer?
step : integer? = 1
Returns a range object.
Returns #t
if v is a vector, array, string, pair, or range, #f
otherwise.
Returns the length of seq.
Returns the element of seq at position pos, where the first element is at position0
. For sequences other than pair?, negative positions are allowed.
Procedure
(slice seq start [stop] [step]) → iterable?
seq : iterable?
start : integer?
stop : integer? = (length seq)
step : integer? = 1
Returns the elements of seq from start inclusively to stop exclusively. If step is negative, then stop is inclusive and start is exclusive.
Returns seq in reverse order.
Returns #t
regardless of the value of v.