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
(define id expr) Syntax
Set id to the result of expr.
(set! id expr) Syntax
Set id to the result of expr if id is already defined. If id is not defined, raise an error.
(lambda args body) Syntax
Produces a procedure that accepts args arguments and runs body when called.
(λ args body) Syntax
Clone of lambda.
(define/c (proc-bind [id-binding contract]... )) Syntax
Define a procedure with contracts.
(if test-expr then-expr else-expr) Syntax
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 bool?.
(when test-expr body) Syntax
Evaluates test-expr. If #t then evaluate body else do nothing. An error will be raised if evaluated test-expr is not a bool?.
(cond ([test-clause then-body]... [else then-body)) Syntax
Evaluate each cond-clause if the clause is evaluated to #t then evaluate and return then-body. If the clause is #f continue to the next clause. If there are no clauses left return #<void>. If the last test-clause is else then its evaluated then-body.
(for ([id seq-expr] ...) body) Syntax
Loop over seq-expr by setting the variable id to the nth item of seq-expr and evaluating body.
(for/vector ([id seq-expr] ...) body) Syntax
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.
true : bool? Value
An alias for #t.
false : bool? Value
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 an integer and v is greater than 0, #f otherwise.
Returns #t if v is a float, #f otherwise.
Returns #t if v is a float and v is >= 0 and <= 1, #f otherwise.
Returns #t if v is a fraction (a rational number), #f otherwise.
Returns (= z 0)
Returns (> x 0)
Returns (< x 0)
Returns (zero? (mod n 2))
Returns (not (even? n))
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 the real part of z.
Returns the imaginary part of z.
Returns the closest integer to x resolving ties in favor of even numbers.
Returns the smallest integer bigger than x.
Returns the largest integer less than x.
(random ) → float? Procedure
Returns a random number between 0.0 inclusive to 1.0 exclusive.
Returns a random int between start and stop inclusive.
Returns z raised to the w power.
Returns the square root of z.
Returns Euler's number raised to the z power.
Returns the natural logarithm of x. If b is provided it serves as an alternative base.
Returns the sine of z in radians.
Returns the cosine of z in radians.
Returns the tangent of z in radians.
pi : float? Value
A floating point approximation of 𝜋: the circumference of a circle divided by its diameter.
Returns #t if v is a symbol, #f otherwise.
Returns a new string whose characters are the same as in sym.
Returns a symbol whose characters are the same as str.
Returns #t if v is a string, #f otherwise.
Returns #t if v is a char, #f otherwise.
Returns a new string from the given chars.
Returns a new string concatenated from the given strs
Returns the corresponding int to the given char.
Returns the character corresponding to k.
Returns z as a string.
(~a v ...) → string? Procedure
v : datum?
Converts all vs to a string using display with "" as the joiner.
(~s v ...) → string? Procedure
v : datum?
Converts all vs to a string using display with " " as the joiner.
(~v v ...) → string? Procedure
v : datum?
Converts all v to a string using print with " " as the joiner.
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.
Returns a new vector with all elements of vecs appended in order.
Modify vec so that all elements of vec2s are appended to the end of vec in order.
Returns a new string filled with the characters of str.
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.
Returns a freshly allocated array with dtype as its datatype and the value v filled.
Modify arr by setting start to stop into the value v.
Returns the number of non-zeros in arr.
Returns #t if v is an array with 'bool as its datatype, #f otherwise.
(bool-array v ...) → bool-array? Procedure
v : uint?
Returns a new boolean array with v as its values.
Returns a new bool-array? with left and right margin applied.
(and first-expr rest-expr ...) Syntax
Evaluate first-expr if the result is a bool-array? evaluate all rest-exprs and return the logical-and of all arrays. If the result is #f evaluate rest-expr one at a time. Return immediately if any arg is #f, return #t if all values are #t.
(or first-expr rest-expr ...) Syntax
Evaluate first-expr if the result is a bool-array? evaluate all rest-exprs and return the logical-and of all arrays. If the result is #t evaluate rest-expr one at a time. Return immediately if any arg is #t, return #f if all values are #f.
(xor expr1 expr2) → (or/c bool? bool-array?) Procedure
expr1 : (or/c bool? bool-array?)
expr2 : (or/c bool? bool-array?)
Returns a new boolean or boolean-array based on the exclusive-or of expr1 and expr2. expr2 must be the same type as expr1.
(not h) → (or/c bool? bool-array?) Procedure
h : (or/c bool? bool-array?)
Returns the inverse of h.
Turn all 0s sections that are less than x in length to 1s. 0s represent cuts and 1s represent clips.
Turn all 1s sections that are less than x in length to 0s
all : 'all Value
The symbol 'all. Exists for backwards compatibility for older auto-editor versions
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.
(car p) → any? Procedure
p : pair?
Returns the first element of pair p.
(cdr p) → any? Procedure
p : pair?
Returns the second element of pair p.
null : null? Value
The empty list.
Returns #t if v is an empty list or a pair whose second element is a list, #f otherwise.
Returns a list with v in order.
Returns the element of lst at position pos.
Returns a new list based on vec.
Returns a new vector based on lst.
Returns a new list filled with the characters of str.
Returns (car (car v))
Returns (car (cdr v))
Returns (cdr (car v))
Returns (cdr (cdr v))
Returns #t if v is a range object, #f otherwise.
Returns a range object.
Returns a new vector based on rng.
Returns a new list based on rng.
Returns #t if v is a vector array string hash pair or range, #f otherwise.
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 position 0. For sequences other than pair?, negative positions are allowed.
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 if v is a hash table, #f otherwise.
Returns a newly constructed hash map from key-value pairs.
Returns #t if key is in the hash map, #f otherwise.
Adds a delay by timeseconds.
(error msg) Procedure
msg : string?
Raises an exception with msg as the message.
(exit [status]) Procedure
status : uint? = 1
Immediately terminates the program.
Evaluates all arguments and returns the last one.
Display datum to stdout.
Display datum to stdout with a newline character.
Display datum like REPL does.
Display datum like REPL does with a newline character.
(with-open (file-binding file-path file-mode) body-expr) Syntax
In the block the file object to file-binding
.(with-open (file "shopping.txt" 'a) ((. file write) "buy milk"))
Returns #t if v is #<void>, #f otherwise.
Returns the constant #<void>. All v arguments are ignored.
Returns #t if v is a procedure, #f otherwise.
Returns #t if v is a contract, #f otherwise. A contract is either a bool?, number?, string?, symbol?, or a predicate.
Always returns #t regardless of the value of v.
Returns a new sequence with the results of proc applied to each element.
Applies proc given seq as its arguments.
Takes any number of contracts and returns a contract predicate that accepts any values that satisfies all contracts.
Takes any number of contracts and returns a contract predicate that accepts any values that can satisfy one or more contracts.
Takes one contract and returns a contract that accepts one value and satisfies the opposite of the given contract.
Returns a new contract that requires the input to be real? and >= than n.
Returns #t if v is an object, #f otherwise. Anything that's not an object is a primitive.
Returns all attributes of obj as a vector of strings.
(@r obj attr) Syntax
Returns the specified attribute on the object.
(eval body) Syntax
Evaluate value if value is a vector or list, otherwise return the value.
(quote body) Syntax
Returns body as its "literalized" form, a constant value with its binding names copied.
Returns #t if the variable corresponding to sym is defined in the current environment, #f otherwise.