-
Notifications
You must be signed in to change notification settings - Fork 1
Autumn Standard Library Documentation
Autumn is a Lisp-like language with S-expressions. All code is wrapped in parentheses, with the first element being the operator or function name. The language is designed for game programming with built-in support for physics and collision detection.
Below is a formal presentation of the grammar for both expressions (Expr
) and statements (Stmt
), integrating the relevant token types (e.g.,
-
$\textit{Expr}$ denotes an expression node. -
$\textit{Stmt}$ denotes a statement node. -
$\textit{Token}[X]$ indicates a token whose$\texttt{TokenType}$ is$X$ . -
$\textit{T*}$ indicates a list of elements of type$T$ . - Braces
$( \dots )$ enclose parameter lists for each construct.
Expressions:
Assign ::= "=" (name : Token[IDENTIFIER]) (value : Expr)
Binary ::= op : { PLUS, MINUS, STAR, SLASH, MODULO } (left : Expr) (right : Expr)
Call ::= (callee : Expr) (arguments : Expr)* | ((callee))
Grouping ::= (expression : Expr)
Literal ::= Token[NUMBER | STRING | TRUE | FALSE | NIL]
Logical ::= (op : { AND, OR }) (left : Expr) (right : Expr)
Get ::= ".." (object : Expr) (name : Token[IDENTIFIER])
Unary ::= (op : { BANG, MINUS }) (right : Expr)
Lambda ::= "-->" (params : Token[IDENTIFIER]*) (right : Expr)
Variable ::= (name : Token[IDENTIFIER])
TypeExpr ::= (name : Token[IDENTIFIER])
TypeDecl ::= ":" (name : Token[IDENTIFIER]) (typeexpr : TypeExpr)
ListTypeExpr ::= "List" (typeexpr : TypeExpr)
ListVarExpr ::= "list" (varExprs : Expr)*
IfExpr ::= "if" (condition : Expr) "then" (elseBranch : Expr)
Let ::= "Let" (exprs : Expr)*
InitNext ::= "initnext" (initializer : Expr) (nextExpr : Expr)
Statements:
Object ::= "object" (name : Token[IDENTIFIER]) (fields : TypeExpr*) (Cell : Expr)*
Expression ::= (expression : Expr)
OnStmt ::= "on" (condition : Expr) (expr : Expr)
We provide the script in tools/generate_ast.cpp to generate and modify this grammar quickly.
-
Single-character tokens:
$\texttt{LEFT\_PAREN}$ $($ ,$\texttt{RIGHT\_PAREN}$ $)$ ,$\texttt{LEFT\_BRACE}$ $\{$ ,$\texttt{RIGHT\_BRACE}$ $\}$ ,$\texttt{COMMA}$ $\texttt{,}$ ,$\texttt{DOT}$ $.$ ,$\texttt{MINUS}$ $-$ ,$\texttt{PLUS}$ $+$ ,$\texttt{SLASH}$ $/$ ,$\texttt{STAR}$ $*$ ,$\texttt{COLON}$ $:$ ,$\texttt{MODULO}$ $%$ . -
Multi-character tokens:
$\texttt{BANG\_EQUAL}$ $!=$ ,$\texttt{EQUAL\_EQUAL}$ $==$ ,$\texttt{GREATER\_EQUAL}$ $\ge$ ,$\texttt{LESS\_EQUAL}$ $\le$ ,$\texttt{MAPTO}$ $\rightarrow$ . -
Literals:
$\texttt{IDENTIFIER}$ (variable names),$\texttt{STRING}$ ,$\texttt{NUMBER}$ ,$\texttt{TRUE}$ ,$\texttt{FALSE}$ ,$\texttt{NIL}$ . -
Keywords:
$\texttt{PROGRAM}$ $\text{program}$ ,$\texttt{AND}$ (either & or$\texttt{and}$ ,$\texttt{OBJECT}$ $\texttt{object}$ ,$\texttt{ELSE}$ $\texttt{else}$ ,$\texttt{FUN}$ $\texttt{fn}$ ,$\texttt{IF}$ $\texttt{if}$ ,$\texttt{THEN}$ $\texttt{then}$ ,$\texttt{ON}$ $\texttt{on}$ ,$\texttt{OR}$ (either$\texttt{or}$ or |),$\texttt{LET}$ $\texttt{let}$ ,$\texttt{INITNEXT}$ .
For modifying Token (adding token types, etc. please look at TokenType header file
Below is a compact set of examples illustrating each expression type and statement type from the grammar. Every snippet is wrapped in a (program ...) form for completeness, but in real usage, you would mix and match these constructs as needed.
Expression Examples
- Assign
(program
(= x 42) ; Assigning the literal 42 to variable x
)
- Explanation: The expression
(= x 42)
assigns the value 42 to a variable named x.
- Binary
(program
(on true
(let
(= sum (+ 2 3)) ; Binary expr: (+ 2 3)
(print sum)
true
)
)
)
- Explanation:
(+ 2 3)
is a binary expression using the + operator.
- Call
(program
(: foo (fn (a b) (* a b))) ; A simple lambda function for multiplication
(= result (foo 10 5)) ; Call expr: (foo 10 5)
)
- Explanation:
(foo 10 5)
calls the function stored in foo with arguments 10 and 5.
- Get
(program
(object Player (: health Number) (Cell 0 0 "blue"))
(: player Player)
(= player (Player (Position 5 5)))
(= currentHealth (.. player health)) ; Get expr: (.. player health)
)
- Explanation:
(.. player health)
accesses the health field from the object player.
- Grouping
(program
(= grouped ( ( + 1 (* 2 3) ) )) ; Grouping expr around (+ 1 (* 2 3))
)
- Explanation: Grouping is demonstrated by wrapping expressions in parentheses (though in Autumn’s Lisp-like syntax, parentheses are already used heavily). The outer parentheses around
(+ 1 (* 2 3))
illustrate grouping.
- Literal
(program
(= str "hello world") ; Literal string
(= num 123) ; Literal number
(= boolValue true) ; Literal boolean
)
- Explanation: Literal values can be strings, numbers, booleans, or nil.
- Logical
(program
(= x 3)
(= y 10)
(= check (& (> x 2) (== y 10))) ; Logical expr: (& (> x 2) (== y 10))
)
- Explanation: This checks the conjunction (&) of two comparisons: x > 2 and y == 10.
- Set
(program
(object Agent (: speed Number) (Cell 0 0 "red"))
(: myAgent Agent)
(= myAgent (Agent (Position 4 4)))
(= (.. myAgent speed) 99) ; Set expr: updates the 'speed' field of 'myAgent'
)
- Explanation: (= (.. myAgent speed) 99) modifies the speed field of myAgent.
- Unary
(program
(: value Number)
(= value 5)
(= negValue (- value)) ; Unary minus
(= notAlive (! alive)) ; Unary bang (if alive is a bool)
)
- Explanation:
- (- value) is the unary negation of value.
- (! alive) would be a unary logical NOT, assuming alive is a boolean variable.
- Lambda
(program
(= adder (fn (a b) (+ a b))) ; A lambda function taking two params a, b
(= result (adder 7 8)) ; Calls the lambda -> 15
)
- Explanation: (fn (a b) (+ a b)) is a lambda expression assigned to adder.
- Variable
(program
(: x Number) ; Declare variable x
(= x 10) ; Variable usage
(on true (print x)) ; x is used directly
)
- Explanation: x is a simple variable referred to by name.
- TypeDecl
(program
(: MyCustomType Bool)
)
- Explanation: Declares a new type MyCustomType as a list of some type T (In this case, Bool). (Requires having typevariable Bool declared somewhere.)
- ListTypeExpr
(program
(: MyType (List Bool)) ; Interpreted as "List of Number"
)
- Explanation: (listtypeexpr Number) means a type expression for a list of Number.
14. ListVarExpr
```sexp
(program
(= items (list 1 2 3 4)) ; Creates a list of literal values
)
- Explanation: (list 1 2 3 4) is a typical “ListVarExpr” usage, returning a list expression of values.
- IfExpr
(program
(= x 5)
(= result (if (> x 3) then "x is large" else "x is small")) ; IfExpr
)
- Explanation: (if (> x 3) ... ...) is the conditional expression returning one of two branches.
- Let
(program
(on true
(let
(= a 1)
(= b 2)
(print (+ a b)) ; -> prints 3
true
)
)
)
- Explanation: A let expression creates local bindings (a, b) and then executes sub-expressions, and return value of the final expression evaluation
- InitNext
(program
(: counter Number)
(= counter (initnext 0 ( + (prev counter) 1 )))
)
- Explanation: On initialization, counter is 0. Each subsequent timestep, it sets counter to (prev counter) + 1.
- Object
(program
(object Player (: health Number) (Cell 0 0 "blue"))
(object Enemy (: damage Number) (Cell 0 0 "red"))
)
- Explanation: Defines two object types, Player and Enemy, each with fields and a base Cell.
- Expression (Statement)
(program
(+ 1 2)
(print "Hello from an expression stmt")
)
- Explanation: An Expression statement simply evaluates an expression where a statement is allowed (e.g., top-level or inside a block).
- OnStmt
(program
(= x 0)
(on (< x 5)
(= x (+ x 1))
)
)
- Explanation: onStmt triggers the expression body whenever the condition (< x 5) evaluates to true. Here, it increments x until it reaches
Below is a comprehensive set of documentation for every function defined in the Autumn Stdlib, as well as brief documentation for functions/calls referenced but not defined within the snippet.
-
Description: Moves the given object
obj
by the vectordir
. -
Parameters:
-
obj
: The object to move (must have anorigin
property). -
dir
: APosition
object specifying the displacement in x and y.
-
-
Returns: A new version of
obj
whoseorigin
has been updated toorigin + dir
.
-
Description: Moves the given object
obj
exactly one unit to the right (x + 1). -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated object with the x-coordinate of
origin
incremented by 1.
-
Description: Moves the given object
obj
exactly one unit to the left (x - 1). -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated object with the x-coordinate of
origin
decremented by 1.
-
Description: Moves the given object
obj
exactly one unit up (y - 1). -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated object with the y-coordinate of
origin
decremented by 1.
-
Description: Moves the given object
obj
exactly one unit down (y + 1). -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated object with the y-coordinate of
origin
incremented by 1.
-
Description: Moves
obj
by(x, y)
only if the resulting position is free, excluding any collision checks with the originalobj
itself. -
Parameters:
-
obj
: The object to move. -
x
: The change in the x-direction. -
y
: The change in the y-direction.
-
-
Returns: A new version of
obj
if the position is free, otherwise returns the originalobj
without movement.
-
Description: Moves
obj
by(x, y)
if the resulting position is free, excluding collisions withobj
andobj2
. -
Parameters:
-
obj
: The primary object to move. -
x
: The change in the x-direction. -
y
: The change in the y-direction. -
obj2
: A second object to exclude from collision checks.
-
- Returns: The updated object if the position is free, otherwise the original object.
-
Description: Rotates
obj
(using an external functionrotate
) only if the rotated object:- Remains within bounds.
- Does not collide with anything except the original
obj
.
-
Parameters:
-
obj
: The object to rotate.
-
- Returns: The rotated object if rotation is valid, otherwise the original object.
-
Description: Computes a new
Position
by addingdir
topos
. -
Parameters:
-
pos
: APosition
object. -
dir
: APosition
specifying how much to move in x and y.
-
-
Returns: A new
Position
with updated coordinates.
-
Description: Returns a new
Position
moved one unit to the right frompos
. -
Parameters:
-
pos
: The initialPosition
.
-
-
Returns:
Position(pos.x + 1, pos.y)
.
-
Description: Returns a new
Position
moved one unit to the left. -
Parameters:
-
pos
: The initialPosition
.
-
-
Returns:
Position(pos.x - 1, pos.y)
.
-
Description: Returns a new
Position
moved one unit up. -
Parameters:
-
pos
: The initialPosition
.
-
-
Returns:
Position(pos.x, pos.y - 1)
.
-
Description: Returns a new
Position
moved one unit down. -
Parameters:
-
pos
: The initialPosition
.
-
-
Returns:
Position(pos.x, pos.y + 1)
.
-
Description: Returns the absolute value of
x
. -
Parameters:
-
x
: A number.
-
-
Returns: Absolute value of
x
.
-
Description: Determines the sign of
x
. -
Parameters:
-
x
: A number (integer, as Autumn does not have float yet).
-
-
Returns:
-
-1
ifx < 0
-
0
ifx == 0
-
1
ifx > 0
-
-
Description: An alias for
concat
. In this code,vcat
is set toconcat
. - Parameters: Varies depending on usage, typically a list of lists to concatenate.
- Returns: A single concatenated list.
-
Description: Computes the difference in coordinates between
pos2
andpos1
. -
Parameters:
-
pos1
: The firstPosition
. -
pos2
: The secondPosition
.
-
-
Returns: A new
Position
=(pos2 - pos1)
, i.e.(pos2.x - pos1.x, pos2.y - pos1.y)
.
-
Description: Generates a list of
Position
objects for the rectangular region spanning from(pos1.x, pos1.y)
to(pos2.x, pos2.y)
, excluding the upper bound if the language follows typicalrange
conventions. -
Parameters:
-
pos1
: The top-leftPosition
. -
pos2
: The bottom-rightPosition
.
-
-
Returns: A flattened list of
Position
objects representing each coordinate in the rectangle.
-
Description: An alias for
deltaPos
. Computes the displacement between two positions. -
Parameters:
-
pos1
: The firstPosition
. -
pos2
: The secondPosition
.
-
-
Returns: A
Position
representing(pos2 - pos1)
.
-
Description: Computes the coordinate difference between two elements by comparing their
position
property. -
Parameters:
-
e1
: An element with aposition
. -
e2
: Another element with aposition
.
-
-
Returns: The result of
deltaPos(e1.position, e2.position)
.
-
Description: Computes the difference between the
origin
of two objects. -
Parameters:
-
obj1
: First object with anorigin
. -
obj2
: Second object with anorigin
.
-
-
Returns: A
Position
representing(obj2.origin - obj1.origin)
.
-
Description: Checks if two elements (
e1
ande2
) are adjacent on a grid, meaning the sum of the absolute difference in x plus y coordinates is1
. -
Parameters:
-
e1
: An element with aposition
. -
e2
: Another element with aposition
.
-
-
Returns: Boolean
true
if they are horizontally or vertically adjacent, otherwisefalse
.
-
Description: Checks if two positions are within
unitSize
adjacency in a grid sense. Here, adjacency is defined byabs(delta.x) + abs(delta.y) <= unitSize
. -
Parameters:
-
p1
: APosition
. -
p2
: AnotherPosition
. -
unitSize
: The threshold for adjacency.
-
-
Returns: Boolean
true
if withinunitSize
, elsefalse
.
-
Description: Checks if
obj1
andobj2
are adjacent, using the same logic asadjacentPoss
on theirorigin
. -
Parameters:
-
obj1
: First object. -
obj2
: Second object. -
unitSize
: Adjacency threshold.
-
-
Returns: Boolean
true
if withinunitSize
, elsefalse
.
-
Description: Checks if two positions are adjacent including diagonals, i.e.
abs(delta.x) <= 1
andabs(delta.y) <= 1
. -
Parameters:
-
p1
: APosition
. -
p2
: APosition
.
-
-
Returns: Boolean
true
if they are adjacent in any of the 8 surrounding squares, elsefalse
.
-
Description: Uses
adjacentPossDiag
to check diagonal adjacency between two objects. -
Parameters:
-
obj1
: First object. -
obj2
: Second object.
-
-
Returns: Boolean
true
if diagonally (or directly) adjacent, elsefalse
.
-
Description: Finds all objects in the global
allObjs()
list that are adjacent toobj1
(or each object inobj1
, ifobj1
is a list) givenunitSize
. -
Parameters:
-
obj1
: The object or list of objects. -
unitSize
: The threshold for adjacency.
-
-
Returns: A list of objects from
allObjs()
that are adjacent.
-
Description: Finds all objects in the global
allObjs()
list that are adjacent toobj
(or each object inobj
, ifobj
is a list) including diagonals. -
Parameters:
-
obj
: The object or list of objects.
-
- Returns: A list of objects considered adjacent diagonally or orthogonally.
-
Description: Checks if
obj
is adjacent to any object inobjs
givenunitSize
. -
Parameters:
-
obj
: The object to check. -
objs
: A list of objects. -
unitSize
: Adjacency threshold.
-
-
Returns: Boolean
true
if adjacency is found with at least one inobjs
, elsefalse
.
-
Description: Filters a list of objects, returning only those that have been "clicked" (based on an external
clicked
function). -
Parameters:
-
objs
: A list of objects to check.
-
-
Returns: A list of objects for which
clicked(obj) == true
.
- Description: Computes the squared distance between two positions.
-
Parameters:
-
pos1
: APosition
. -
pos2
: AnotherPosition
.
-
-
Returns:
(delta.x * delta.x + delta.y * delta.y)
, wheredelta = pos2 - pos1
.
-
Description: Computes a "unit vector" (in grid sense) from
obj
's origin totarget
's origin. If both x and y need to move and are both nonzero, it defaults to moving only along x first (i.e.(sign_x, 0)
). -
Parameters:
-
obj
: The "source" object. -
target
: The "destination" object.
-
-
Returns: A
Position
(sign_x, sign_y)
representing direction, with a special rule if both are nonzero.
-
Description: Similar to
unitVector
, but the target is a bare positionpos
instead of an object. -
Parameters:
-
obj
: The "source" object (has anorigin
). -
pos
: A directPosition
.
-
-
Returns: A
Position
(sign_x, sign_y)
using the same logic asunitVector
.
-
Description: Returns the maximum of
a
andb
. -
Parameters:
-
a
: A number. -
b
: A number.
-
-
Returns: The larger of
a
andb
.
-
Description: Returns the minimum of
a
andb
. -
Parameters:
-
a
: A number. -
b
: A number.
-
-
Returns: The smaller of
a
andb
.
-
Description: From a list of objects, finds the one with the smallest squared distance to
obj
. -
Parameters:
-
obj
: The reference object. -
listObjs
: A list of objects.
-
-
Returns: The single closest object in
listObjs
. Returnsobj
iflistObjs
is empty.
-
Description: From a list of positions, finds the position closest (in squared distance) to
obj
's origin. -
Parameters:
-
obj
: The reference object (with anorigin
). -
listPoss
: A list ofPosition
s.
-
-
Returns: The closest
Position
by squared distance. Returnsobj.origin
iflistPoss
is empty.
-
Description: Produces a list of renderable elements for
obj
. Ifobj
is a list, concatenates all of their renderValues. If a single object, returns(.. obj render)
. -
Parameters:
-
obj
: An object or list of objects that can be rendered.
-
-
Returns: A list of rendered elements (or concatenated lists if
obj
is a list).
-
Description: Checks if any element in
elems1
shares the same position as any element inelems2
. -
Parameters:
-
elems1
: A list of elements (each with aposition
). -
elems2
: Another list of elements.
-
-
Returns: Boolean
true
if at least one position overlaps, otherwisefalse
.
-
Description: Checks if a given
pos
coincides with theposition
of any element inelems
. -
Parameters:
-
pos
: APosition
. -
elems
: A list of elements (each with aposition
).
-
-
Returns: Boolean
true
if any element matchespos
, elsefalse
.
-
Description: Checks if
pos
is contained in the list of positionsposs
. -
Parameters:
-
pos
: APosition
. -
poss
: A list ofPosition
objects.
-
-
Returns: Boolean
true
ifpos
is inposs
, elsefalse
.
-
Description: Determines if
obj1
andobj2
have any intersecting elements by comparing their rendered values. -
Parameters:
-
obj1
: An object (or list of objects). -
obj2
: Another object (or list of objects).
-
-
Returns: Boolean
true
if their rendered elements overlap.
-
Description: Checks if all rendered elements of
obj
occupy free positions (i.e., no collisions). -
Parameters:
-
obj
: An object or list of objects to check for collisions.
-
-
Returns: Boolean
true
if none of the positions are blocked, elsefalse
.
-
Description: Checks if element
e
is in listl
. -
Parameters:
-
e
: Element to find. -
l
: A list.
-
-
Returns: Boolean
true
ife
is found inl
, otherwisefalse
.
-
Description: Checks if all rendered elements of
obj
are free, ignoring collisions withprev_obj
’s rendered elements. -
Parameters:
-
obj
: The object to check. -
prev_obj
: The object whose elements we ignore in collision checks.
-
-
Returns: Boolean
true
if none of the new positions (beyond those occupied byprev_obj
) are blocked, otherwisefalse
.
-
Description: Checks if a single position
pos
is free or is intersecting only withobj
. -
Parameters:
-
pos
: APosition
. -
obj
: The object to ignore in collision checks.
-
-
Returns: Boolean
true
ifpos
is free or only occupied byobj
.
-
Description: Checks positions in the range
[start, end)
along the x-axis (y=0 in the code snippet) to see if they are free, excluding theobj
's positions. -
Parameters:
-
start
: Start of the x-range. -
end
: End of the x-range (exclusive if using typicalrange
). -
obj
: The object to exclude from collisions.
-
-
Returns: Boolean
true
if all those positions are free except for whereobj
is, elsefalse
.
-
Description: Moves
obj
one unit to the left if it is within bounds and free (excluding the object’s own current space). -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated
obj
if valid, otherwise returnsobj
unchanged.
-
Description: Moves
obj
one unit to the right if it is within bounds and free. -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated
obj
if valid, otherwiseobj
.
-
Description: Moves
obj
one unit up if it is within bounds and free. -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated
obj
if valid, otherwiseobj
.
-
Description: Moves
obj
one unit down if it is within bounds and free. -
Parameters:
-
obj
: The object to move.
-
-
Returns: The updated
obj
if valid, otherwiseobj
.
-
Description: This is simply an alias set to
moveDownNoCollision
. Typically used in contexts where an object moves like a “solid” block. -
Parameters:
-
obj
: The object to move down.
-
-
Returns: The updated
obj
if valid, otherwise the originalobj
.
-
Description: Finds the closest "hole" (position) among
holes
and attempts to moveobj
toward it usingnextLiquidMoveClosestHole
. -
Parameters:
-
obj
: The object representing a liquid droplet (or similar). -
holes
: A list of positions representing available holes.
-
-
Returns: The moved
obj
if a hole is found and the path is free, or the originalobj
otherwise.
-
Description: Simulates liquid movement:
- If
obj
can move down freely and isn’t at the bottom, it moves down. - Else, it scans the next row for "holes" and attempts to move toward the closest one.
- If
-
Parameters:
-
obj
: The liquid-like object to move.
-
-
Returns: The updated
obj
after applying liquid movement logic.
-
Description: Moves
obj
towardclosestHole
by computing a direction viaunitVectorObjPos
and verifying free space. -
Parameters:
-
obj
: The object representing a liquid droplet. -
closestHole
: APosition
representing the hole’s location.
-
-
Returns: The updated
obj
if movement is valid, otherwise the originalobj
.
Below are brief descriptions of native functions or constructs:
-
updateObj(obj, propertyName, newValue)
Updates the objectobj
by setting itspropertyName
tonewValue
. Returns a new or updated version ofobj
. -
Position(x, y)
Represents a coordinate pair with fieldsx
andy
. Used extensively for movement and geometry. -
isFreePos(pos)
Checks if the positionpos
is free (i.e., not occupied or blocked) in the game/grid world. -
isWithinBounds(obj)
Checks ifobj
(or possibly its rendered elements) lies within the valid boundaries of the grid/board. -
rotate(obj)
Rotatesobj
in some manner (e.g., rotating the shape or positions). Used byrotateNoCollision
. -
isList(value)
Tests whethervalue
is recognized as a list in this language. -
allObjs()
Returns a list of all objects that exist in the current environment or game state. -
addObj oldList newObj
Add thenewObj
to theoldList
. -
removeObj oldList oldObj
Remove theoldObj
from theoldList
. -
clicked(obj)
Checks ifobj
was clicked (mouse/touch event). Used byobjClicked
. -
map(function, list)
Appliesfunction
to each element oflist
, returning a new list of results. -
filter(function, list)
Retains only those elements fromlist
for whichfunction(element)
returnstrue
. -
any(function, list)
Returnstrue
iffunction(element)
istrue
for at least one element inlist
, otherwisefalse
. -
foldl(function, initValue, list)
Left-fold (reduce): iterates throughlist
, applyingfunction(acc, elem)
, carrying forward an accumulator. -
head(list)
Returns the first element oflist
. -
at(list, idx)
Returns theidx
th element in the list. -
tail(list)
Returns the last element oflist
. -
concat(listOfLists)
Flattens or concatenates a list of lists into a single list. -
range(start, end)
Returns a list of integers fromstart
up to but not includingend
(based on typical usage in the code). -
print(value)
Outputsvalue
for debugging or logging purposes. -
Logical Operators (used in the code):
-
and
,or
,not
(shown as(! ...)
)
Standard logical operations for combining boolean expressions. -
if (condition) then (expr1) else (expr2)
Standard conditional expression.
-