Basic Features Last updated: 2024-01-15

The Programmer is the part of the platform where you write and edit your programs.

An explanation for beginners of some of the basic features of the Programmer.

Blocks

  • Machine blocks are created in the Add machine block window.
  • Constants are created in the Add constant window.
  • Terminals are created in the Specify terminal block window.
  • Input blocks are created in the Add input block window.
  • New blocks will be placed wherever in the board the crosshairs are currently located.
  • The crosshairs can be moved by left-clicking an empty section of the board.
  • If the scrollbar of the board is moved, the crosshairs will be moved to the upper left corner of the visible area of the board.

Connector nodes

  • Connector nodes are the blue squares joined by blue lines that connect the output of a block with the input of another block. All block outputs have an output node attached to them (large, solidly colored). Subnodes (smaller, solidly colored), are children either of an output node or of another subnode. Input nodes (large, hollow) are connected to an input of a block and are children either of an output node or of a subnode. If a subnode is dragged to an input of the same type (or of a compatible generic type) as the output to which its ancestor output node is attached, it will get attached to the input and become an input node. Each input can have only one input node attached to it.
nodosexp
  • To create a new subnode, place the cursor over the desired parent node, then press and drag the right mouse button. A new subnode will appear, and as long as you don't release the right mouse button, you can move the new subnode with the cursor. Please note that input nodes can't have children, only output nodes and subnodes.
newsubnode
  • To move an already existing subnode, place the cursor over it, then press and drag the left mouse button. As long as you don't release the left mouse button, you can move the subnode with the cursor. Output and input nodes can't be moved directly. They move automatically when the block that they are attached to is moved.
movenode
  • If you hold the space bar while moving a subnode or an input node, the node will get either horizontally or vertically aligned with its parent, depending on the position of the cursor relative to the parent.
spacebaral
  • If a subnode or an output node has only one child, you can align it horizontally or vertically with its child by holding Shift while moving the node.
shiftal
  • If you right-click a subnode or an input node and select Split in the popup menu, a new subnode will appear between the node and its parent.
splitnode
  • Subnodes and input nodes can be deleted by right-clicking them and selecting Delete in the popup menu that appears. If you delete a node with children, its parent will become the parent of its children. Output nodes can't be directly deleted.
splitnode
  • If you left-click the type label of an output, all the descendants of its output node will be deleted.
pressoutput
  • If you delete a block, its output nodes and all their descendants will be deleted.
deleteblocknodes
  • If you press and hold Ctrl a green circle will surround the node that is closest to the cursor, and it will disappear as soon as you release Ctrl. As long as the circle is visible, pressing the left or right mouse buttons will have the same effect as if the cursor was above the node.
circuloverde

Block slectors

Groups of blocks can be moved all at once with a block selector. Block selectors are also the only way to copy or cut blocks. Pressing the right mouse button when the cursor is in an empty part of a board and dragging the cursor without releasing the mouse button will create a block selector. As soon as you release the mouse button, the selector will be fixed with one corner where the cursor was when you originally pressed the right mouse button, and the opposite corner will be where the cursor was when you released the button.

As long as a selector exists, the blocks that were inside of it (or more specifically, whose upper left corner was inside of it) when it was fixed will be associated with it. You can drag the selector and its associated blocks by pressing and holding the left mouse button when the cursor is above one of the corners of the selector.

selector

Right-clicking a corner of the selector will open a popup menu that will allow you to delete all the blocks associated to the selector, or to copy or cut the selector and the blocks associated to it. Right-click an empty section of a board to open a popup menu that will give the option to paste a copied selector.

deleteselectorcopyselector

Keyboard shortcuts

Shortcuts that open windows:

  • Ctrl+L: opens the Add machine block window in the Elemental machines tab.
  • Ctrl+B: opens the Add machine block window in the Imported machines tab.
  • Ctrl+I: opens the Add machine block window in the Internal machines tab.
  • Ctrl+F: opens the Add machine block window in the Favourite machines tab.
  • Ctrl+K: opens the Add constant window.
  • Ctrl+H opens the Add input block window.
  • Ctrl+R opens the Specify terminal block window.
  • Ctrl+M creates a new comment wherever the crosshairs are located.
  • Ctrl+E opens the Edit project window.
  • Ctrl+N opens the New internal machine window.
  • Ctrl+O opens the Open internal machine window.
  • Ctrl+T opens the Edit internal machine window
  • Ctrl+D opens the Delete internal machine window.
  • Crtl+S saves the current project.
  • Ctrl+P compiles the current project.
  • Ctrl+U opens the parent board of the currently open board unless the root board of the internal machine is already open.
  • Ctrl+W opens the root board of the current internal machine.
  • Ctrl+A opens the board tree of the current internal machine.

Pressing Enter is equivalent to clicking on the window's main button in the following windows:

  • Add constant
  • Add input block
  • Specify terminal block
  • Open internal machine
  • Delete internal machine

Pressing Ctrl+Enter is equivalent to clicking on the window's main button in the following windows:

  • Add machine block
  • New project
  • Edit project
  • New internal machine
  • Edit internal machine

Rank modifiers Last updated: 2023-11-1

A brief description of how rank modifiers work in ExMachina and how to use them.

Rank-1 modifiers

Rank modifiers allow you to apply a function to multiple values at once. In most languages, you use loops to do this, each cycle reading one value from the input lists, applying the function to those values, and storing the result in an output list. In ExMachina, you can use rank modifiers to apply a function to each value of an array without using loops:

Rank-1 integer sum

The integer sum block has the rank-1 modifier (^1), which indicates that the base function will be applied to each pair of elements in the input arrays, and the results will be collected and returned as an array. At their most basic form, rank-1 modified functions work like this:

Rank-1 function without submodifiers

To modify the rank of a function, use the + and - buttons in the lower right part of the Add machine block window:

Add machine block window

Submodifiers

There are three submodifiers that can be used to alter the way rank-modified functions work. Two work on inputs (Extend and Fold) and one works on outputs (Reduce/Refer). Please note that at least one input should not have any submodifiers, so Extend and Fold can only be used in functions with more than one input.

To add a submodifier to an input or output, use the combo boxes that appear in the right part of the Add machine block window after modifying the rank of the function:

Add machine block window 2
Extend submodifier

If you want to use the same value as one of the inputs in all iterations, you can use the Extend modifier on that input:

Extend submodifier
Fold submodifier

If you want to apply a function recursively to the elements of an array (e.g. add all the numbers in a num array), you use the Fold submodifier. The following image shows how Fold works:

Fold submodifier
Reduce/Refer submodifier

If you are only interested in the last value of an iterative process, you can use the Reduce/Refer submodifier. The following image shows how Reduce works:

Reduce submodifier

It is important to note that no final value will be available if the output array is empty. The default action in this case will be to throw a ReductionFailureException. However, you can use Refer to make the function return one of the inputs instead (as long as said input has the appropriate rank and type).

Example: factorial

The following is a very concise implementation of the factorial function in ExMachina:

Factorial

The sequence block returns the array [1,2,...,N] where N is the number that we want to calculate the factorial of. The xI block is rank-1 modified, has a Fold in the first input, and has a Reduce in the output with a Refer to the first input. The first input receives a 1. This causes the block to multiply the first value in the array by one, then multiply the result by the next value of the array, and so on, and then return only the result of the final multiplication.

It is important to note that when N=0, the array returned by the sequence block will be empty, so the reduction at the output of xI will fail and the 1 that is received by the first input will be returned instead. This is the correct result. It is no coincidence that this works, and might provide some insight into why 0!=1. The following image shows the Add machine block window with the correct rank modifier and submodifiers for the xI block:

Add block window

Rank-2 or higher modifiers

The following image shows how rank-K modifiers where K>1 work:

Rank-K modifiers

Here is another image with more detail for the specific case of rank 2:

Rank-2 modifier

The following image shows the Add machine block with the rank-2 modifier:

Rank-2 modifier

The submodifiers have to be specified for each rank 1,2,...,K. It is important to note that changing the submodifiers in a rank will reset all submodifiers in higher ranks to their default state, so make sure to specify all submodifiers in rank 1 before specifying the submodifiers in rank 2, and so on.

Example: matrix multiplication

The following image shows an implementation of integer matrix multiplication AxB:

Integer matrix multiplication

First, matrix B is transposed, then the values of both matrices are multiplied with a rank-3 modified xI block with an extend submodifier in the first input in rank 2, and an extend submodifier in the second input in rank 3. The result will be a rank 3 array with the products of all values in matrix A times all values in matrix B. All the values of each rank 1 array in this array are then added with a rank-3 modified +I block with a fold in the first input in rank 1, an extend in the first input in rank 2, and an extend in the first input in rank 3. The result is a rank 2 array with the product of A times B. The Add machine block windows with the appropriate submodifiers for the xI block and the +I block are shown in the following images:

Add machine block window xI in mat multFigure 15. Add machine block window +I in mat mult

Elemental Machines Last updated: 2023-08-30

The elemental machines are the most basic functions of the language. All other functions are made by composing elemental functions.

Arrays

addInitial

Description:

Creates a new array by inserting the 'newElement' at the beginning of 'array'.

Properties:
InputsOutputs
NamenewElement, array*newArray
Rank{ 0, 1 }{ 1 }
ClassT%%Class, *T%%Class*T%%Class
Ilustration:
addInitial machine

addFinal

Description:

Creates a new array by inserting the 'newElement' at the end of 'array'.

Properties:
InputsOutputs
NamenewElement, array*newArray
Rank{ 0, 1 }{ 1 }
ClassT%%Class, *T%%Class*T%%Class
Ilustration:
addFinal machine

batch

Description:

Divides an array into C subarrays, where C=n if 0<n<=array size, otherwise C=array size. The difference between the size of any two subarrays will be at most 1, and no subarray will have a larger size than a subarray with a smaller index.

Properties:
InputsOutputs
Namen, arraysubarrays
Rank{ 0, 1 }{ 0, 1 }
ClassInteger, *T%%Class**T%%Class
Ilustration:
batch machine

bind

Description:

Binds all input arrays into a single array.

Properties:
InputsOutputs
Namearray1, array2output
Rank{ 1, 1 }{ 1 }
Class*T%%Class, *T%%Class*T%%Class
Ilustration:
bind machine

collapse

Description:

Binds all the internal arrays of 'uncollapsed'.

Properties:
InputsOutputs
Nameuncollapsedcollapsed
Rank{ 2 }{ 1 }
Class**T%%Class*T%%Class
Ilustration:
collapse machine

countEq

Description:

Returns the number of elements in the 'array' that are equal to the 'prototype'.

Properties:
InputsOutputs
Nameprototype, arraycount
Rank{ 0, 1 }{ 0 }
ClassT%%Class, *T%%ClassInteger
Ilustration:
countEq machine

crarray

Description:

Creates a new array using the input tokens as elements.

Properties:
InputsOutputs
Nameelement1, ..., elementNoutput
Rank{ 0 }{ 1 }
ClassT%%Class*T%%Class
Ilustration:
crarray machine

dirEmpty

Description:

Creates an empty array of the same type and degree as 'prototype'.

Properties:
InputsOutputs
NameprototypeemptyArray
Rank{ 1 }{ 1 }
Class*T%%Class*T%%Class
Ilustration:
dirEmpty machine

fill

Description:

Creates an array of the given size such that all of its values are repetitions of the element.Creates an array of size 'size' such that all of its values are repetitions 'element'. Returns an empty array if 'size' is 0 or negative.

Properties:
InputsOutputs
Namesize, elementarray
Rank{ 0, 0 }{ 1 }
ClassInteger, T%%Class*T%%Class
Ilustration:
fill machine

finalWR

Description:

Output 'isEmpty' is true if 'array' is empty, and is false otherwise. Output 'element' is the last value in 'array' if 'array' is not empty, otherwise it is 'replacement'.

Properties:
InputsOutputs
Namearray, replacementusedReplacement, element
Rank{ 1, 0 }{ 0, 0 }
Class*T%%Class, T%%ClassBoolean, T%%Class
Ilustration:
finalWR machine

get

Description:

Returns the value at the position in 'array' indicated by 'index'. Arrays are 0-indexed. Throws IndexOutOfBounds if 'index' is negative or equal or larger than the size of 'array'.

Properties:
InputsOutputs
Nameindex, arrayelement
Rank{ 0, 1 }{ 0 }
ClassInteger, *T%%ClassT%%Class
Ilustration:
get machine

getWR

Description:

Output usedReplacement is true if the index is not valid (i.e. the index is negative or greater or equal than the size of the array), is false otherwise. Output 'element' is the value at the position in the array indicated by 'index' if 'index' is valid. It is 'replacement' otherwise.

Properties:
InputsOutputs
Nameindex, array, replacementusedReplacement, element
Rank{ 0, 1, 0 }{ 0, 0 }
ClassInteger, *T%%Class, T%%ClassBoolean, T%%Class
Ilustration:
getWR machine

group

Description:

Divides an array into as many subarrays of size C as possible, where C=n if 0<n<=array size, otherwise C=array size. The last subarray may have less than C elements if there are not enough elements left to fill it.

Properties:
InputsOutputs
Namen, arraysubarrays
Rank{ 0, 1 }{ 2 }
ClassInteger, *T%%Class**T%%Class
Ilustration:
group machine

indexFirst

Description:

Returns the index of the first appearance 'value' in 'array'. If 'value' does not appear in 'array', returns -1.

Properties:
InputsOutputs
Namearray, valueindexFirst
Rank{ 1, 0 }{ 0 }
Class*T%%Class, T%%ClassInteger
Ilustration:
indexFirst machine

initialWR

Description:

Output 'isEmpty' is true if 'array' is empty, and is false otherwise. Output 'element' is the first value in 'array' if 'array' is not empty, otherwise it is 'replacement'.

Properties:
InputsOutputs
Namearray, replacementisEmpty, element
Rank{ 1, 0 }{ 0, 0 }
Class*T%%Class, T%%ClassBoolean, T%%Class
Ilustration:
initialWR machine

insert

Description:

Output 'newArray' is 'oldArray' with 'newElement' inserted at the position indicated by 'index'. Throws IndexOutOfBounds if 'index' is negative or larger than the size of 'oldArray'.

Properties:
InputsOutputs
Nameindex, newElement, oldArraynewArray
Rank{ 0, 0, 1 }{ 1 }
ClassInteger, T%%Class, *T%%Class*T%%Class
Ilustration:
insert machine

invert

Description:

Inverts the order of the elements in 'array'.

Properties:
InputsOutputs
NamearrayinvertedArray
Rank{ 1 }{ 1 }
Class*T%%Class*T%%Class
Ilustration:
invert machine

pushInitial

Description:

Inserts 'newElement' at the beginning of 'array' and removes the last value. 'newArray' will always have the same size as 'array'.

Properties:
InputsOutputs
NamenewElement, arraynewArray
Rank{ 0, 1 }{ 1 }
ClassT%%Class, *T%%Class*T%%Class
Ilustration:
pushInitial machine

pushFinal

Description:

Inserts 'newElement' at the beginning of 'array' and removes the last value. 'newArray' will always have the same size as 'array'.

Properties:
InputsOutputs
NamenewElement, arraynewArray
Rank{ 0, 1 }{ 1 }
ClassT%%Class, *T%%Class*T%%Class
Ilustration:
pushFinal machine

pushAllInitial

Description:

Adds all the values in 'newElements' to the beginning of 'array' and then removes the last n values, where n is the size of 'newElements'. 'newArray' will always have the same size as 'array'.

Properties:
InputsOutputs
NamenewElements, arraynewArray
Rank{ 1, 1 }{ 1 }
Class*T%%Class, *T%%Class*T%%Class
Ilustration:
pushAllInitial machine

pushAllFinal

Description:

Adds all the values in 'newElements' to the end of 'array' and then removes the first n values, where n is the size of 'newElements'. 'newArray' will always have the same size as 'array'.

Properties:
InputsOutputs
NamenewElements, arraynewArray
Rank{ 1, 1 }{ 1 }
Class*T%%Class, *T%%Class*T%%Class
Ilustration:
pushAllFinal machine

replace

Description:

Output 'newArray' is 'oldArray' with the value at 'index' replaced with 'newElement'. Throws IndexOutOfBounds if 'index' is negative or larger or equal than the size of 'oldArray'.

Properties:
InputsOutputs
Nameindex, newElement, oldArrayoldElement, newArray
Rank{ 0, 0, 1 }{ 0, 1 }
ClassInteger, T%%Class, *T%%ClassT%%Class, *T%%Class
Ilustration:
replace machine

segment

Description:

Returns a segment of 'array' that starts at 'array'(start) and ends at 'array'(C-1), where C=end if end>=0, otherwise C='array' length. An IndexOutOfBounds exception is thrown if the following condition is not met: 'array' size >= C >= 'start' >= 0.

Properties:
InputsOutputs
Namestart, end, arraysegment
Rank{ 0, 0, 1 }{ 1 }
ClassInteger, Integer, *T%%Class*T%%Class
Ilustration:
segment machine

sequence

Description:

Output 'sequence' is a sequence of integers that starts at 'initialValue', has a size of 'numberOfElements', and the difference between any value and the previous value is 'step'.

Properties:
InputsOutputs
NameinitialValue, step, numberOfElementssequence
Rank{ 0, 0, 0 }{ 1 }
ClassInteger, Integer, Integer*Integer
Ilustration:
sequence machine

shift

Description:

If 'n'>0, shifts the values of 'array' 'n' positions to the left. Any element that gets shifted beyond the length of the array will appear at the beginning of the array. If 'n'<0, shift the elements of the array |'n'| positions to the right. Any element that gets shifted beyond the beginning of the array will appear at the end of the array. If 'n'=0, there is no shift.

Properties:
InputsOutputs
Namen, arrayshiftedArray
Rank{ 0, 1 }{ 1 }
ClassInteger, *T%%Class*T%%Class
Ilustration:
shift machine

size

Description:

Returns the length of 'array'.

Properties:
InputsOutputs
Namearraylength
Rank{ 1 }{ 0 }
Class*T%%ClassInteger
Ilustration:
size machine

sizeB

Description:

Returns the length of 'array'+'offset'.

Properties:
InputsOutputs
Namearray, offsetlength
Rank{ 1,0 }{ 0 }
Class*T%%Class,intInteger
Ilustration:
sizeB machine

split

Description:

Divides an array into two subarrays. Subarray1 starts at element(0) and ends at element(index-1). Subarray2 starts at the element(index) and ends at the last element. Throws IndexOutofBounds: if index<0 or index>array's length.

Properties:
InputsOutputs
Nameindex, arraysubarray1, subarray2
Rank{ 0, 1 }{ 1, 1 }
ClassInteger, *T%%Class*T%%Class, *T%%Class
Ilustration:
split machine

transpose

Description:

Transposes an array of arrays. If the internal arrays in 'original' are not all of the same sizes, then any space in 'transposed' is filled with 'replacement'.

Properties:
InputsOutputs
Nameoriginal, replacementtranspose
Rank{ 2, 0 }{ 2 }
Class**T%%Class, *T%%Class**T%%Class
Ilustration:
transpose machine

trmInitial

Description:

Output 'element' is the first value in 'array'. Output 'trimmedArray' is 'array' without the first value. Throws IndexOutOfBounds if 'array' is empty.

Properties:
InputsOutputs
Namearrayelement, trimmedArray
Rank{ 1 }{ 0, 1 }
Class*T%%ClassT%%Class, *T%%Class
Ilustration:
trmInitial machine

trmFinal

Description:

Output 'element' is the last value in 'array'. Output 'trimmedArray' is 'array' without the last value. Throws IndexOutOfBounds if 'array' is empty.

Properties:
InputsOutputs
Namearrayelement, trimmedArray
Rank{ 1 }{ 0, 1 }
Class*T%%ClassT%%Class, *T%%Class
Ilustration:
trmFinal machine

Maps

allKeys

Description:

Returns an array with all the keys in the map.

Properties:
InputsOutputs
Namemapkeys
Rank{ 0 }{ 1 }
ClassMap*Any
Ilustration:
trmFinal machine

allToMap

Description:

Returns a new version of the map where the given keys are associated with the given values. Throws UnmatchingInputSize if 'keys' and 'values' don't have the same size.

Properties:
InputsOutputs
Namekeys, values, mapmap
Rank{ 1, 1, 0 }{ 0 }
Class*Any, *Any, MapMap
Ilustration:
allToMap machine

createHMap

Description:

Creates a map with the given values associated with the given keys. If a key appears more than once in the" + " input, it will be associated with the last value that it is paired with. Throws UnmatchingInputSize if 'keys' and 'values' don't have the same size.

Properties:
InputsOutputs
Namekeys, valuesmap
Rank{ 1, 1 }{ 0 }
Class*Any, *AnyMap
Ilustration:
createHMap machine

fetch

Description:

Reads the 'value' associated to 'key' from 'map'. Throws ElementNotFound if no value is associated with 'key'.

Properties:
InputsOutputs
Namekey, mapvalue
Rank{ 0, 0 }{ 0 }
ClassAny, MapAny
Ilustration:
fetch machine

fetchAll

Description:

Returns an array with all the keys in the map, and an array with all the values in the map

Properties:
InputsOutputs
Namemapkeys, values
Rank{ 0 }{ 1, 1 }
ClassMap*Any, *Any
Ilustration:
fetchAll machine

fetchWR

Description:

If 'key' exists in 'map', 'usedReplacement' is false. Otherwise, it is true. Reads the 'value' associated with 'key' from 'map'. If no value is associated to 'key', 'value' is 'replacement'

Properties:
InputsOutputs
Namekey, map, replacementusedReplacement, value
Rank{ 0, 0, 0 }{ 0, 0 }
ClassAny, Map, AnyBoolean, Any
Ilustration:
fetchWR machine

isKey

Description:

Returns true if 'key' is associated to a value in 'map'. Returns false otherwise.

Properties:
InputsOutputs
Namekey, mapisKey
Rank{ 0, 0 }{ 0 }
ClassAny, MapBoolean
Ilustration:
isKey machine

mapSize

Description:

Returns the number of key-value pairs in the map.

Properties:
InputsOutputs
Namemapsize
Rank{ 0 }{ 0 }
ClassMapInteger
Ilustration:
mapSize machine

removeAllKV

Description:

Returns a new version of the map that no longer contains the given keys and their associated values.

Properties:
InputsOutputs
Namekeys, mapmap
Rank{ 1, 0 }{ 0 }
Class*Any, MapMap
Ilustration:
removeAllKV machine

removeKV

Description:

Returns a new version of the map that no longer contains the given key and its associated value.

Properties:
InputsOutputs
Namekey, mapmap
Rank{ 0, 0 }{ 0 }
ClassAny, MapMap
Ilustration:
removeKV machine

toMap

Description:

Returns a new version of the map where 'key' is associated with the 'value'.

Properties:
InputsOutputs
Namekeys, value, mapmap
Rank{ 0, 0, 0 }{ 0 }
ClassAny, Any, MapMap
Ilustration:
toMap machine

Logic

& | and

Description:

Returns true only if all inputs are true, returns false otherwise.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
and machine

nand

Description:

Returns false if all inputs are true, returns true otherwise.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
nand machine

! | not

Description:

Returns false if 'value' is true and true if 'value' is false

Properties:
InputsOutputs
Namevaluenegation
Rank{ 0 }{ 0 }
ClassBooleanBoolean
Ilustration:
negation machine

asBln

Description:

Converts a value into a boolean. If the value is a boolean, the boolean will be the same as the value. If the value is an int, the boolean will be false if the integer is 0, and true otherwise. If the value is a num that, the boolean will be false if the num is 0.0 or NaN, and true otherwise. If the value is a byte, the boolean will be false if the byte is 0x00, and true otherwise. If the value is a string, the boolean will be false if the string is empty, and true otherwise. If the value is a map, the boolean will be false if the map is empty, and true otherwise. If the value is a token of a composite class, the boolean will be false if the token has no fields, and true otherwise. If the value is an array, the boolean will be false if the array is empty, and true otherwise.

Properties:
InputsOutputs
Namevalueboolean
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
asBln machine

nor

Description:

Returns false if at least one input is true, returns true otherwise.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
nor machine

| | or

Description:

Returns true if at least one input is true, returns false otherwise

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
or machine

xnor

Description:

Returns true if an even number of inputs are true, returns false otherwise.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
xnor machine

xor

Description:

Returns true if an odd number of inputs are true, returns false otherwise.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassBoolean, BooleanBoolean
Ilustration:
xor machine

IntMath

absI

Description:

Returns the absolute value of the number.

Properties:
InputsOutputs
Namenumberabs
Rank{ 0 }{ 0 }
ClassIntegerInteger
Ilustration:
absI machine

/I | Division

Description:

'quotient'='dividend'/'divisor'

Properties:
InputsOutputs
Namedividend, divisorquotient
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
division machine

+1

Description:

'sum'='summand'+1

Properties:
InputsOutputs
Namesummandsum
Rank{ 0 }{ 0 }
ClassIntegerInteger
Ilustration:
+1 machine

-1

Description:

'difference'='minuend'-1

Properties:
InputsOutputs
Nameminnuenddifference
Rank{ 0 }{ 0 }
ClassIntegerInteger
Ilustration:
-1 machine

expI | Exponential

Description:

'power'='base'^'exponent'

Properties:
InputsOutputs
Nameexponent, baseexponential
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
exponential machine

gcd | Greatest Common Divisor

Description:

Returns the greatest common denominator of integers 'a' and 'b'.

Properties:
InputsOutputs
Namea, bgcd
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
gcd machine

lcm | Least Common Multiple

Description:

Returns the least common multiple of integers 'a' and 'b'.

Properties:
InputsOutputs
Namea, blcm
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
lcm machine

modulo

Description:

Returns the remainder of the division between 'dividend' and 'divisor'.

Properties:
InputsOutputs
Namedividend, divisorremainder
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
modulo machine

xI | Multiplication

Description:

'product'='factor1' x 'factor2' x ... x 'factorN'

Properties:
InputsOutputs
Namefactor1, factor2product
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
multiplication machine

negI | Negation

Description:

'neg'=-'value'

Properties:
InputsOutputs
Namevaluenegation
Rank{ 0 }{ 0 }
ClassIntegerInteger
Ilustration:
negation machine

asInt

Description:

Converts a value into an integer. If the value is an int, the integer will be the same as the value. If the value is a num that isn't NaN, the integer will be the closest integer with a smaller or equal absolute value that can be represented as a 64-bit integer. If the value is a NaN, the integer will be 0. If the value is true, the integer will be 1. If the value is false, the integer will be 0. If the value is a byte, the integer will be the byte converted to base 10 (i.e. a number between 0 and 255, inclusive). -If the value is a string, the integer will be the number of chars in the string. If the value is a map, the integer will be the number of key-value pairs in the map. If the value is a token of a composite class, the integer will be the number of fields in the token. If the value is an array, the integer will be the number of elements in the array.

Properties:
InputsOutputs
Namevaluenumber
Rank{ 0 }{ 0 }
ClassT%%ClassInteger
Ilustration:
asInt machine

+I | Addition

Description:

'sum'='summand1'+'summand2'+...+'summandN'

Properties:
InputsOutputs
Namesummand1, summand2sum
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
addition machine

signI | Sign

Description:

If 'number' is negative, returns -1, if it is positive, returns 1, if it is 0, returns 0.

Properties:
InputsOutputs
Namenumbersign
Rank{ 0 }{ 0 }
ClassIntegerInteger
Ilustration:
sign machine

-I | Substract

Description:

'difference'='minuend'-'subtrahend'

Properties:
InputsOutputs
Nameminuend, subtrahenddifference
Rank{ 0, 0 }{ 0 }
ClassInteger, IntegerInteger
Ilustration:
substract machine

NumMath

absN

Description:

Returns the absolute value of 'number'.

Properties:
InputsOutputs
Namenumberabs
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
absN machine

arccos

Description:

Returns the arccosine (in radians) of 'value'.

Properties:
InputsOutputs
Namevaluearccosine
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
arccos machine

arcsin

Description:

Returns the arcsine (in radians) of 'value'.

Properties:
InputsOutputs
Namevaluearcsine
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
arcsin machine

arctan

Description:

Returns the arctangent (in radians) of 'value'.

Properties:
InputsOutputs
Namevaluearctangent
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
arctan machine

bincoef

Description:

Returns the binomial coefficient of the two inputs.

Properties:
InputsOutputs
Namen, kbincoef
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
bincoef machine

ceiling

Description:

Returns the smallest integer that is greater than or equal to the input.

Properties:
InputsOutputs
Namenumberceiling
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
ceiling machine

cos

Description:

Returns the cosine of 'angle' ('angle' is assumed to be in radians).

Properties:
InputsOutputs
Nameanglecosine
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
cos machine

/N | Division

Description:

'quotient'='dividend'/'divisor'

Properties:
InputsOutputs
Namedividend, divisorquotient
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
division machine

expN | Exponential

Description:

'power'='base'^'exponent'

Properties:
InputsOutputs
Nameexponent, basepower
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
exponential machine

fact

Description:

'f'=gamma('n'+1) where gamma is the gamma function. If 'n' is a non-negative integer, this is equivalent to the factorial of 'n'.

Properties:
InputsOutputs
Namenf
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
fact machine

floor

Description:

Returns the largest integer that is less than or equal to the input.

Properties:
InputsOutputs
Namenumberfloor
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
floor machine

asNum

Description:

Converts a value into a floating point number. If the value is a num, the number will be the same as the value. If the value is an int, the number will be the closest integer with a smaller or equal absolute value that can be represented as a 64-bit floating point number. If the value is true, the number will be 1.0. If the value is false, the number will be 0.0. If the value is a byte, the number will be the byte converted to base 10 (i.e. a number between 0 and 255, inclusive). If the value is a string, the number will be the number of chars in the string. If the value is a map, the number will be the number of key-value pairs in the map. If the value is a token of a composite class, the number will be the number of fields in the token. If the value is an array, the number will be the number of elements in the array.

Properties:
InputsOutputs
Namevaluenumber
Rank{ 0 }{ 0 }
ClassT%%ClassNumber
Ilustration:
asNum machine

log

Description:

Returns the logarithm of a value. If antilogarithm is 0 or negative, returns NaN.

Properties:
InputsOutputs
Namebase, antiLogarithmlogarithm
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
log machine

ln

Description:

'antilogarithm'=e^'logarithm'. If 'antilogarithm' is 0 or negative, returns NaN.

Properties:
InputsOutputs
NameantiLogarithmlogarithm
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
ln machine

recip

Description:

'reciprocal'=1.0/'value'

Properties:
InputsOutputs
Namevaluereciprocal
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
recip machine

xN | Multiplication

Description:

'product'='factor1'*'factor2'*...*'factorN'

Properties:
InputsOutputs
Namefactor1, factor2product
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
multiplication machine

negN | Negation

Description:

'neg'=-'value'

Properties:
InputsOutputs
Namevaluenegation
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
negation machine

+N | Addition

Description:

'sum'='summand1'+'summand2'+...+'summandN'

Properties:
InputsOutputs
Namesummand1, summand2sum
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
addition machine

remainder

Description:

Returns the remainder of the division between 'dividend' and 'divisor'.

Properties:
InputsOutputs
Namedividend, divisorremainder
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
remainder machine

round

Description:

Returns the integer that is closest to 'number'. If two integers are equally close, it returns the greatest one

Properties:
InputsOutputs
Namenumberround
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
round machine

signN | Sign

Description:

If the number is negative, returns -1, if it is positive, returns 1, if it is 0, returns 0.

Properties:
InputsOutputs
Namenumbersign
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
sign machine

sin

Description:

Returns the sine of 'angle' ('angle' is assumed to be in radians).

Properties:
InputsOutputs
Nameanglesine
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
sin machine

-N | Substract

Description:

'difference'='minuend'-'subtrahend'

Properties:
InputsOutputs
Nameminuend, subtrahenddifference
Rank{ 0, 0 }{ 0 }
ClassNumber, NumberNumber
Ilustration:
substract machine

tan

Description:

Returns the tangent of 'angle' ('angle' is assumed to be in radians).

Properties:
InputsOutputs
Nameangletangent
Rank{ 0 }{ 0 }
ClassNumberNumber
Ilustration:
tan machine

String

concatenateR

Description:

Concatenates all the strings from the input array into a single output string.

Properties:
InputsOutputs
Namestringsconcatenation
Rank{ 1 }{ 0 }
Class*StringString
Ilustration:
concatenateR machine

concatenateB

Description:

Transforms each input into a string (as with 'info') and then concatenates them into a single string.

Properties:
InputsOutputs
Names1, s2concatenation
Rank{ 0, 0 }{ 0 }
ClassString, StringString
Ilustration:
concatenateB machine

chars

Description:

Divides 'string' into an array of strings with one character each.

Properties:
InputsOutputs
Namestringchars
Rank{ 0 }{ 1 }
ClassString*String
Ilustration:
chars machine

first

Description:

Returns the index of the start of the first occurrence in the string, after or at the offset, of the given substring. Returns -1 if the substring never appears in the string.

Properties:
InputsOutputs
Namestring, substring, offsetindex
Rank{ 0, 0, 0 }{ 0 }
ClassString, String, IntegerInteger
Ilustration:
first machine

last

Description:

Returns the index of the start of the last occurrence in the string, before or at the offset, of the given substring. Returns -1 if the substring never appears in the string.

Properties:
InputsOutputs
Namestring, substring, offsetindex
Rank{ 0, 0, 0 }{ 0 }
ClassString, String, IntegerInteger
Ilustration:
last machine

matches

Description:

Returns true if the string matches the regular exception, returns false otherwise.

Properties:
InputsOutputs
Namestring, regexmatches
Rank{ 0, 0 }{ 0 }
ClassString, StringBoolean
Ilustration:
matches machine

splitStr

Description:

Splits a string around matches of the given regular expression. The limit minus one indicates the maximum number of times the string is split. If the limit is negative, the string is split as many times as possible. If the limit is zero, the string is split as many times as possible, and trailing empty strings are discarded.

Properties:
InputsOutputs
Namestring, regex, limitsplitString
Rank{ 0, 0, 0 }{ 1 }
ClassString, String, Integer*String
Ilustration:
splitStr machine

strLength

Description:

Returns the length of the input string.

Properties:
InputsOutputs
Namestringlength
Rank{ 0 }{ 0 }
ClassStringInteger
Ilustration:
strLength machine

str2int

Description:

Parses a string into an integer. Throws NumberFormatException if the string is not parseable into an integer.

Properties:
InputsOutputs
Namestringinteger
Rank{ 0 }{ 0 }
ClassStringInteger
Ilustration:
str2int machine

str2num

Description:

Parses a string into a floating point number. Throws NumberFormatException if the string is not parseable into a number.

Properties:
InputsOutputs
Namestringnumber
Rank{ 0 }{ 0 }
ClassStringNumber
Ilustration:
str2num machine

substring

Description:

Returns the substring of the given string that starts at the character at position lowerBound, and ends at the character at position upperBound-1. If upperBound=lowerBound returns an empty string.

Properties:
InputsOutputs
Namestring, lowerBound, upperBoundsubstring
Rank{ 0, 0, 0 }{ 0 }
ClassString, Integer, IntegerString
Ilustration:
substring machine

Byte

&byt | And

Description:

Performs bitwise And on all input bytes and returns the result as the output.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassByte, ByteByte
Ilustration:
and machine

|byt | Or

Description:

Performs bitwise Or on all input bytes and returns the result as the output.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassByte, ByteByte
Ilustration:
or machine

!byt | Not

Description:

Performs bitwise Not on all input bytes and returns the result as the output.

Properties:
InputsOutputs
Namevaluenegation
Rank{ 0 }{ 0 }
ClassByteByte
Ilustration:
not machine

asByt

Description:

Converts a value into a byte. If the value is a byte, the byte will be the same as the value. If the value is an int, the byte will be the integer modulo 256. If the value is a num that isn't NaN, the byte will be the integer part of the number modulo 256. If the value is NaN, the byte will be b0. If the value is true, the byte will be b1. If the value is false, the byte will be b0. If the value is a string, the byte will be the number of chars in the string modulo 256. If the value is a map, the byte will be the number of key-value pairs in the map modulo 256. If the value is a token of a composite class, the byte will be the number of fields in the token modulo 256. If the value is an array, the byte will be the number of elements in the array modulo 256.

Properties:
InputsOutputs
Namevaluebyte
Rank{ 0 }{ 0 }
ClassT%%ClassByte
Ilustration:
asByt machine

xorbyt | Xor

Description:

Performs bitwise exclusive or on all input bytes and returns the result as the output.

Properties:
InputsOutputs
Nameinput1, input2output
Rank{ 0, 0 }{ 0 }
ClassByte, ByteByte
Ilustration:
xor machine

bln2byt | Boolean to Byte

Description:

Constructs a byte out of eight individual bits.

Properties:
InputsOutputs
Nameb0, b1, b2, b3, b4, b5, b6, b7byte
Rank{ 0, 0, 0, 0, 0, 0, 0, 0 }{ 0 }
ClassBoolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, BooleanByte
Ilustration:
booleanToByte machine

byt2bln | Byte to Boolean

Description:

Extracts the individual bits of byte

Properties:
InputsOutputs
Namebyteb0, b1, b2, b3, b4, b5, b6, b7
Rank{ 0 }{ 0 }
ClassByteBoolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean
Ilustration:
byteToBoolean machine

byts2int | Byte to Integer

Description:

Reconstructs an integer from its byte representation.

Properties:
InputsOutputs
Namebyte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7int
Rank{ 0, 0, 0, 0, 0, 0, 0, 0 }{ 0 }
ClassByte, Byte, Byte, Byte, Byte, Byte, Byte, ByteInteger
Ilustration:
bytesToInteger machine

int2byts | Integer to Byte

Description:

Transforms an integer into its byte representation.

Properties:
InputsOutputs
Nameintbyte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7
Rank{ 0 }{ 0, 0, 0, 0, 0, 0, 0, 0 }
ClassIntegerByte, Byte, Byte, Byte, Byte, Byte, Byte, Byte
Ilustration:
integerToBytes machine

Filter

classify

Description:

For each of the data arrays, the value at 'dataN'[i] is added to 'filteredDataN' if 'parameters'(i)='condition'.

Properties:
InputsOutputs
Nameparameters, data1filteredParameters, groupedData1
Rank{ 1, 1 }{ 1, 2 }
Class*T%%parameterClass, *T%%dataClass1*T%%parameterClass, *T%%dataClass1
Ilustration:
classify machine

dfilter

Description:

For each of the data arrays, the value at dataN[i] is added to filteredDataN. if parameters[i]=condition, otherwise it is added to nFilteredDataN for all N.

Properties:
InputsOutputs
Namecondition, parameters, data1filteredData1, nFilteredData1
Rank{ 0, 1, 1 }{ 1, 1 }
ClassT%%parameterClass, *T%%parameterClass, *T%%dataClass1*T%%dataClass1, *T%%dataClass1
Ilustration:
dfilter machine

filter

Description:

For each of the data arrays, the value at dataN[i] is added to filteredDataN if parameters[i]=condition, otherwise it is discarded.

Properties:
InputsOutputs
Namecondition, parameters, data1filteredData1
Rank{ 0, 1, 1 }{ 1 }
ClassT%%parameterClass, *T%%parameterClass, *T%%dataClass1*T%%dataClass1
Ilustration:
filter machine

once

Description:

filteredParameters is a parameter with all repeated values removed. If parameters[i]!=parameters[j] for all j<i and filteredParameters[k]=parameters[i], then filteredDataN[k]=dataN[i].

Properties:
InputsOutputs
Nameparameters, data1filteredData1
Rank{ 1, 1 }{ 1 }
Class*T%%parameterClass, *T%%dataClass1*T%%dataClass1
Ilustration:
once machine

nfilter

Description:

For each of the data arrays, the value at 'dataN'(i) is added to 'nFilteredDataN' if 'parameters'(i)!='condition'.

Properties:
InputsOutputs
Namecondition, parameters, data1filteredData1
Rank{ 0, 1, 1 }{ 1 }
ClassT%%parameterClass, *T%%parameterClass, *T%%dataClass1*T%%dataClass1
Ilustration:
nfilter machine

select

Description:

If 'selector' is true, then 'pselN'='pvalN' and 'nselN'='nvalN' for all N. Otherwise, 'pselN'='nvalN' and 'nselN'='pvalN' for all N

Properties:
InputsOutputs
Nameselector, pval, nvalpsel, nsel
Rank{ 0, 0, 0 }{ 0, 0 }
ClassBoolean, T%%Class, T%%ClassT%%Class, T%%Class
Ilustration:
select machine

part

Description:

If 'parameters'(i)=true, then 'data'(i) is added to one of the partitions. 'data'(i) and 'data'(j) will be in the same partition if and only if 'parameters'(k)=true for all i<=k<=j.

Properties:
InputsOutputs
Nameparameters, datapartitions
Rank{ 0, 0, 0 }{ 2 }
ClassBoolean, T%%Class**T%%Class
Ilustration:
part machine

sort

Description:

sortedParameters is parameters stably sorted. If parameters[i] is mapped to sortedParameter[j], then dataN[i] is mapped to sortedData[j].

Properties:
InputsOutputs
Nameparameters, data1sorteredParameters, sortedData1
Rank{ 1, 1 }{ 1, 1 }
Class*T%%parameterClass, *T%%dataClass1*T%%parameterClass, *T%%dataClass1
Ilustration:
sort machine

substitute

Description:

For each of the data arrays, the value at 'dataN'(i) is replaced with 'replacementN' if 'parameters'(i)='condition'.

Properties:
InputsOutputs
Namecondition, parameters, replacement1, data1newData1
Rank{ 0, 1, 0, 1 }{ 1 }
ClassT%%parameterClass, *T%%parameterClass, T%%dataClass1, *T%%dataClass1*T%%dataClass1
Ilustration:
substitute machine

General

= | Equals

Description:

Returns true if all input tokens are equivalent, returns false otherwise.

Properties:
InputsOutputs
Nametoken 0, token 1areEquivalent
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
equals machine

=R

Description:

Returns true if all the values in 'arr' are equivalent, returns false otherwise. Returns true if there are less than two values in 'arr'.

Properties:
InputsOutputs
NamearrareEquivalent
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
equalArray machine

!= | Not Equals

Description:

Returns false if all input tokens are equivalent, returns true otherwise.

Properties:
InputsOutputs
Nametoken 0, token 1areDifferent
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
notEquals machine

> | Greater Than

Description:

Returns true if 'a'>'b1' AND 'a'>'b2' AND ... AND 'a'>'bn'. Returns false otherwise.

Properties:
InputsOutputs
Namefirst, secondcomparison
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
greaterThan machine

>R

Description:

Returns true if 'arr'(0)>'arr'(1) AND 'arr'(1)>'arr'(2) AND ... AND 'arr'(n-1)>'arr'(n). Returns false otherwise. Returns true if there are less than two elements in 'arr'.

Properties:
InputsOutputs
Namearrcomparison
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
greaterThanArray machine

>= | Greater Than or Equal

Description:

Returns true if 'a'>='b1' AND 'a'>='b2' AND ... AND 'a'>='bn'. Returns false otherwise.

Properties:
InputsOutputs
Namefirst, secondcomparison
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
greaterThanOrEqual machine

>=R

Description:

Returns true if 'arr'(0)>='arr'(1) AND 'arr'(1)>='arr'(2) AND ... AND 'arr'(n-1)>='arr'(n). Returns false otherwise. Returns true if there are less than two elements in 'arr'.

Properties:
InputsOutputs
Namearrcomparison
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
greaterThanOrEqualArray machine

< | Less Than

Description:

Returns true if 'a'<'b1' AND 'a'<'b2' AND ... AND 'a'<'bn'. Returns false otherwise.

Properties:
InputsOutputs
Namefirst, secondcomparison
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
lessThan machine

<R

Description:

Returns true if 'arr'(0)<'arr'(1) AND 'arr'(1)<'arr'(2) AND ... AND 'arr'(n-1)<'arr'(n). Returns false otherwise. Returns true if there are less than two elements in 'arr'.

Properties:
InputsOutputs
Namearrcomparison
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
lessThan machine

<= | Less Than or Equal

Description:

Returns true if 'a'<='b1' AND 'a'<='b2' AND ... AND 'a'<='bn'. Returns false otherwise.

Properties:
InputsOutputs
Namefirst, secondcomparison
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassBoolean
Ilustration:
lessThanOrEqual machine

<=R

Description:

Returns true if 'arr'(0)<='arr'(1) AND 'arr'(1)<='arr'(2) AND ... AND 'arr'(n-1)<='arr'(n). Returns false otherwise. Returns true if there are less than two elements in 'arr'.

Properties:
InputsOutputs
Namearrcomparison
Rank{ 0 }{ 0 }
ClassT%%ClassBoolean
Ilustration:
lessThanOrEqualArray machine

compare

Description:

The comparison value starts at 0, and for all inputs: c <- c+1 if vi<v(i+1), c <- c-1 if vi>v(i+1), c <- c if vi=v(i+1). If there are only 2 inputs, returns 1 if v1>v2, 0 if v1=v2 or -1 if v1<v2.

Properties:
InputsOutputs
Namefirst, secondcomparison
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassInteger
Ilustration:
compare machine

compareR

Description:

The comparison value starts at 0, and for all elements in the values array: c <- c+1 if ei<e(i+1), c <- c-1 if ei>e(i+1), c <- c if ei=e(i+1).

Properties:
InputsOutputs
Namevaluescomparison
Rank{ 0 }{ 0 }
ClassT%%Classint
Ilustration:
compareR machine

asany

Description:

Creates an 'Any' token that wraps the value token

Properties:
InputsOutputs
Namevalueany
Rank{ 0 }{ 0 }
ClassT%%ClassAny
Ilustration:
asany machine

getClass

Description:

Returns the 'author', 'library' and 'name' of the class of a token.

Properties:
InputsOutputs
Nametokenauthor, group, name
Rank{ 0 }{ 0 }
ClassT%%ClassString, String, String
Ilustration:
getClass machine

info

Description:

Transforms value into a string.

Properties:
InputsOutputs
Namevalueinfo
Rank{ 0 }{ 0 }
ClassT%%ClassString
Ilustration:
info machine

getVersion

Description:

Returns the version of the class of a token.

Properties:
InputsOutputs
Nametokenversion
Rank{ 0 }{ 0 }
ClassT%%ClassString
Ilustration:
getVersion machine

hash

Description:

Generates a hash value for this token. Equal tokens always return equal hash values.

Properties:
InputsOutputs
Nametokenhash
Rank{ 0 }{ 0 }
ClassT%%ClassInteger
Ilustration:
hash machine

breakpoint

Description:

Displays a popup window with the info of its inputs if the program is running in debug mode and halts the program until the popup is closed.

Properties:
InputsOutputs
Nameelement1element1
Rank{ 0 }{ 0 }
ClassT%%Class1T%%Class1
Ilustration:
breakpoint machine

max

Description:

Returns the greatest input element.

Properties:
InputsOutputs
Nameelement1, element2max
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassT%%Class
Ilustration:
max machine

min

Description:

Returns the smallest of the given values.

Properties:
InputsOutputs
Nameelement1, element2min
Rank{ 0, 0 }{ 0 }
ClassT%%Class, T%%ClassT%%Class
Ilustration:
min machine

rdany

Description:

Extracts the 'value' from an 'Any' token. Throws ExtractionError if the value is not of the same class as 'prototype' or if its rank is not the rank of 'prototype'-1.

Properties:
InputsOutputs
Nameany, prototypevalue
Rank{ 0, 1 }{ 0 }
ClassAny, *T%%ClassT%%Class
Ilustration:
rdany machine

rdanyWR

Description:

If the content of the 'any' token is of the same type and degree as the 'replacement', 'usedReplacement' is false and 'value' is the content of the 'any' token, otherwise 'usedReplacement' is true and 'value' is the 'replacement'.

Properties:
InputsOutputs
Nameany, replacementusedReplacement, value
Rank{ 0, 0 }{ 0, 0 }
ClassAny, T%%ClassBoolean, T%%Class
Ilustration:
rdanyWR machine

Miscellaneous

construct

Description:

Creates a new instance of the given class.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
construct machine

evaluate

Description:

Evaluates the given expression and returns the result.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
evaluate machine

extract

Description:

Extracts the given value from the given object.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
extract machine

readException

Description:

Returns the content from the given exception.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
readException machine

readmsg

Description:

Returns the content from the given message.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
readmsg machine

redref

Description:

Returns the reference from the given object.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
redref machine

retrieve

Description:

Returns the value from the given reference.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
retrieve machine

writemsg

Description:

Creates a message using the given content.

Properties:
InputsOutputs
Name
Rank{ }{ }
Class
Ilustration:
writemsg machine

Terminals Last updated: 2023-08-30

A terminal is the block to which all the data flow of a board converges. Every board must have one, and only one, terminal. There are 11 types of terminals, which are the following:

Out

Description:

This terminal indicates that a machine is done processing data and whatever is received by the Out block will be the output that the machine returns. The types of the inputs of an Out block will exactly match the types of the outputs of the machine.

Ilustration:
Out terminal

Break

Description:

This terminal indicates that a machine is done processing data and whatever is received by the Break block will be the output that the machine returns. Also cuts the process before than expected.

Ilustration:
Break terminal

Loop

Description:

This terminal indicates tail recursion i.e. the machine will “restart” using whatever input the Loop block received as the machine's new input. The types of the inputs of a Loop block will exactly match the types of the inputs of the machine.

Ilustration:
Loop terminal

Throw

Description:

This terminal throws an exception of a type that has to be specified when placing the block on the board. The only input of a Throw block is a string that will be used as the message of the exception that will be thrown.

Ilustration:
Throw terminal

Rethrow

Description:

Throws an exception of the same type as the caught exception that it receives as its first input, and the string that it receives as its second input will be the exception's message.

Ilustration:
Rethrow terminal

RethrowAsIs

Description:

Throws an exception of the same type and with the same message as the caught exception that it receives as its input.

Ilustration:
RethrowAsIs terminal

IfSwitch

Description:

When an IfSwitch block is placed on a board, two new boards are created: an if case board and an else case board.

The first input of an IfSwitch block is of boolean type and labeled switch, and an arbitrary number of additional inputs of arbitrary type can be specified when the block is placed at the board.

During runtime, if the boolean received at the switch input is true, then the data flow will proceed to the if case board. Otherwise, it will proceed to the else case board. The values received at the additional inputs of the IfSwitch block can be accessed from the if case and else case boards (or from any of their descendant boards) with an Input block.

Ilustration:
IfSwitch terminal

StringSwitch

Description:

When a StringSwitch block is placed on a board, an arbitrary number of cases must be declared. Each of these cases must be either a string (e.g. “foo”) or a list of two or more strings (e.g. “world”, “hello”). Any given string can only appear in one of the cases of a StringSwitch block. There is also a default case called the else case.

The first input of a StringSwitch block is of str type and labeled switch, and an arbitrary number of additional inputs of arbitrary type can be specified when the block is placed at the board.

During runtime, if the string received at the switch input matches one of the cases, then the data flow will proceed to the corresponding case board. Otherwise, it will proceed to the else case board. The values received at the additional inputs of the IntSwitch block can be accessed from the if case and else case boards (or from any of their descendant boards) with an Input block.

Ilustration:
StringSwitch terminal

IntSwitch

Description:

When an IntSwitch block is placed on a board, an arbitrary number of cases must be declared. Each of these cases must be either an integer (e.g. 1) or a list of two or more integers (e.g. 5,3). Any given integer can only appear in one of the cases of an IntSwitch block. There is also a default case called the else case.

The first input of an IntSwitch block is of int type and labeled switch, and an arbitrary number of additional inputs of arbitrary type can be specified when the block is placed at the board.

During runtime, if the integer received at the switch input matches one of the cases, then the data flow will proceed to the corresponding case board. Otherwise, it will proceed to the else case board. The values received at the additional inputs of the IntSwitch block can be accessed from the if case and else case boards (or from any of their descendant boards) with an Input block.

Ilustration:
IntSwitch terminal

Catch

Description:

When a Catch block is placed on a board, an arbitrary number of cases must be declared. Each of these cases must be either an exception type (e.g. “IndexOutOfBounds”) or a list of two or more exception types (e.g. “IndexOutOfBounds”, “InvalidInput”). Any given exception type can only appear in one of the cases of a Catch block. There is also a default case called the else case.

The Catch block has an arbitrary number of inputs of arbitrary type that can be specified when the block is placed at the board. During runtime, if an exception is thrown by any block in the board where the Catch block is placed, the exception will be caught if its type matches one of the cases of the Catch block. If an exception is caught, the program will proceed to the matching case's board.

The inputs accessible from that board will be the same as the ones accessible from the board where the Catch block was placed, plus the caught exception. If no exception is thrown, the program will proceed to the else case's board. The inputs of the Catch block will be accessible from the else case's board. If an exception that does not match any case is thrown, it will not be caught.

Ilustration:
Catch terminal

CatchAll

Description

When a CatchAll block is placed on a board, two new boards are created: a caught case board and an else case board. The CatchAll block has an arbitrary number of inputs of arbitrary type that can be specified when the block is placed at the board.

During runtime, if an exception is thrown by any block in the board where the Catch block is placed, and the exception will be caught, the program will proceed to the caught case's board.

The inputs accessible from that board will be the same as the ones accessible from the board where the Catch block was placed, plus the caught exception. If no exception is thrown, the program will proceed to the else case's board. The inputs of the Catch block will be accessible from the else case's board.

Ilustration
CatchAll terminal

Constants Last updated: 2023-08-30

A constant is a user-defined value set during program declaration, possessing a specific data type. To declare a constant in ExMachina, press ctrl+k. An 'Add Constant' window will appear. Only enter the value, and the program will automatically determine the data type.

nodosexp

Scalars

Represents a singular piece of data, contrasting with an array.

  • Integers: Whole numbers (no decimals) like 1, 2, or -10.
  • Floating-point Numbers: Numbers with decimals, like 3.14 or -5.2.
  • Strings: Sequences of characters enclosed in quotation marks, like 'Hello, world!'
  • Booleans: Represent true or false values (logical data).

Arrays

Arrays are ordered collections of elements of the same data type. Elements are accessed using an index, which starts at 0 (first element) and goes up to the array size minus 1 (last element).

The range of an array is determined by its number of dimensions; each dimension represents a direction or axis. A one-dimensional array, also named a rank one array, consists of scalar elements. Moving up, a two-dimensional array, also named a rank two array, forms an array of rank one arrays, and so on.

To create an array, list the values within square brackets, separated by commas. To create an empty array add the type of data you want inside the square brackets.

  • Boolean: [bln].
  • Integer: [int].
  • Floating-point: [num].
  • String: [str].
nodosexpnodosexp

To generate an array with a range of size n, include n-1 asterisks before specifying the data type. For example, [*str] produces a two-dimensional array of strings.

nodosexpnodosexp

Machine References

A reference allows you to refer to an existing internal machine you've declared. Once referenced, the 'evaluate' elemental machine can execute it. To create a reference, write the internal machine name in the 'Add constant' window. ExMachina will automatically handle the reference creation, identifying input and output data types.

nodosexpnodosexp

Projects Last updated: 2023-08-30

undefined

nodosexp

Each program consists of a primary machine and a set of internal machines.

Primary Machine

The main machine shares the project's name, while each internal machine has its unique name.

Internal Machines

Users have the flexibility to create numerous internal machines, each with its unique name. It's necessary to define the input and output for each machine, specifying both a name and data type. External sources cannot access internal machines within the project.

nodosexp

Boards

Each machine is divided into boards, each of which contains exactly one terminal. The machines are organized in a tree structure. When a switch is added as a terminal, new branches are created, with each branch representing a board associated with a case of the switch.

Order of Execution

ExMachina operates on lazy evaluation principles, whereby expressions or functions remain unevaluated until needed. Consequently, evaluation only occurs when specific operations require results rather than immediate execution. In the presence of multiple boards (switches), the program initiates evaluation from the terminal of the initial board, navigating through true branches and backtracking as necessary. Once evaluated, it determines the subsequent course of action, repeating the process accordingly.

The ex library Last updated: 2023-08-30

The ex library is ExMachina's main library. It is included with the platform. It contains machines that are useful for a wide range of applications (basic IO, HTTP requests, file reading/writing, GUIs, etc.)

actor

What's an actor?

The actor model in computer science is a mathematical model of concurrent computation that treats an actor as the basic building block of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their private state, but can only affect each other indirectly through messaging (removing the need for lock-based synchronization).

Package description:

The package contains machines that are useful for working with actors and messages.

Machines:

createChildFromMachine

Description:

Creates a child actor with a given machine as it's main machine.

Properties:
InputsOutputs
NameeventId, machineAuthor, machineGroup, machineNameevent
Rank{ 0, 0, 0, 0 }{ 1 }
ClassString, String, String, String*msg
Ilustration:
createChildFromMachine machine

deleteTS

Description:

Creates a message that removes the token associated with the given key from the TS.

Properties:
InputsOutputs
Namekeymessage
Rank{ 0 }{ 1 }
ClassString*msg
Ilustration:
deleteTS machine

getActorId

Description:

Retrieves the id of the current actor from the context token.

Properties:
InputsOutputs
Namecontextid
Rank{ 0 }{ 0 }
ClassCxString
Ilustration:
getActorId machine

getEventId

Description:

Retrieves the id of the currently processed event from the context token.

Properties:
InputsOutputs
Namecontextid
Rank{ 0 }{ 0 }
ClassCxString
Ilustration:
getEventId machine

getEventPayload

Description:

Retrieves the payload of the currently processed event from the context token.

Properties:
InputsOutputs
Namecontext, prototypepayload
Rank{ 0, 1 }{ 0 }
ClassCx, *T%%PayloadClassT%%PayloadClass
Ilustration:
getEventPayload machine

getEventSource

Description:

Retrieves the source of the currently processed event from the context token.

Properties:
InputsOutputs
Namecontextsource
Rank{ 0 }{ 0 }
ClassCxString
Ilustration:
getEventSource machine

getEventType

Description:

Retrieves the type of the currently processed event from the context token.

Properties:
InputsOutputs
Namecontexttype
Rank{ 0 }{ 0 }
ClassCxString
Ilustration:
getEventType machine

getTimeStamp

Description:

Returns the date, in number of milliseconds since Jan 01 1970. (UTC), at the start of the current event evaluation cycle.

Properties:
InputsOutputs
NamecontexttimeStamp
Rank{ 0 }{ 0 }
ClassCxInteger
Ilustration:
getTimeStamp machine

print

Description:

Creates a message that writes the string representation of a token into the console.

Properties:
InputsOutputs
Nametokenadrevent
Rank{ 0 }{ 1 }
ClassT%%Class*msg
Ilustration:
printt machine

println

Description:

Creates a message that writes the string representation of a token into the console in a new line.

Properties:
InputsOutputs
Nametokenadrevent
Rank{ 0 }{ 1 }
ClassT%%Class*msg
Ilustration:
println machine

rdTS

Description:

Tries to retrieve a token from the temporary storage. The token is expected to be of the same class as the prototype and its degree should be one degree less than the prototype.

Properties:
InputsOutputs
Namekey, context, prototypevalue
Rank{ 0, 0, 1 }{ 0 }
ClassString, Cx, *T%%ClassT%%Class
Ilustration:
rdTS machine

removeChild

Description:

Removes a child actor.

Properties:
InputsOutputs
NameeventId, childIfevent
Rank{ 0, 0 }{ 1 }
ClassString, String*msg
Ilustration:
removeChild machine

removeTimer

Description:

Creates a message that removes the timer with the given id.

Properties:
InputsOutputs
NameeventId, timerIdtsEvent
Rank{ 0, 0 }{ 1 }
ClassString, String*msg
Ilustration:
removeTimer machine

setPeriodicTimer

Description:

Creates an Event that sets a new timer that, after the initial delay has elapsed, activates repeatedly, with the given period, until it is stopped. Throws InvalidInputValue if the period is not positive.

Properties:
InputsOutputs
NameeventId, timerId, period, intialDelaytsEvent
Rank{ 0, 0, 0 }{ 1 }
ClassString, String, Integer, Integer*msg
Ilustration:
setPeriodicTimer machine

setTimer

Description:

Creates an Event that sets a new timer that activates once the specified time has elapsed and then is automatically removed. Throws InvalidInputValue if time is not positive.

Properties:
InputsOutputs
NameeventId, timerId, delaytsEvent
Rank{ 0, 0, 0 }{ 1 }
ClassString, String, Integer*msg
Ilustration:
setTimer machine

stop

Description:

Creates a message that terminates the current execution instance.

Properties:
InputsOutputs
NametsEvent
Rank{ }{ 1 }
Class*msg
Ilustration:
stop machine

toTs

Description:

Creates an Event that stores a token at the TS under a given key.

Properties:
InputsOutputs
Namekey, datatsEvent
Rank{ 0, 0 }{ 1 }
ClassString, T%%DataType*msg
Ilustration:
toTS machine