Function Reference

This page is a list of every function you can use to build components.

  • ScreenWidth::Number
    The width of the screen.
  • ScreenHeight::Number
    The height of the screen.
  • Matched::Any
    The data associated with the currently matched event.
  • Cell::idx Text->Any
    Reference a cell by name.
  • AbsoluteCell::path Array->Any
    The value of the cell at the given absolute path.
  • AbsoluteCellExpression::path Array->Any
    The expression defined in the cell at the given absolute path.
  • Quote::expr Any->Any
    When evaluated, this function returns the wrapped expression directly.
  • Eval::expr Any->Any
    Evaluate an expression using the context of the evaluating node.
  • EvalContainer::container Any->Any
    Evaluate each expression in a container. Returns the same container, but each value is the result from evaluating.
    EvalContainer(
    "A"
    Add(1, 2)
    "B"
    Multiply(6, 3)
    )
    ->
    "A"
    3
    "B"
    18
    EvalContainer(
    [Add(1, 2),Multiply(6, 3)]
    )
    ->
    [3,18]
  • NodeChildrenInfo::path Array->Map
    Get information about the subcomponents of a node.
  • NodeCellsInfo::path Array->Array
    Information about the cells defined on a node.
  • NodePersistence::path Array->Text
    The persistence state of a node.
  • NodeGeneratedBy::path Array->ComponentRef
    The generating expression or component for a node.
  • ChildNodeAbsolutePath::relative Array->Array
    The absolute path of a cell in a subcomponent.
  • CellAbsolutePath::Text->Array
    The absolute path of a cell in the evaluating component.
  • Lowercase::Text->Text
    Convert all letters to lowercase.
    Lowercase("Hi, I am a sentence!")->"hi, i am a sentence!"
  • Uppercase::Text->Text
    Convert all letters to uppercase.
    Uppercase("Hi, I am a sentence!")->"HI, I AM A SENTENCE!"
  • ExpressionAsMap::expr Any->Map
    Convert a function expression into its arguments and name.
  • Not::Bool->Bool
    Logical NOT.
    Not(true)->false
  • Cos::Number->Number
    Trigonometric cos.
    Cos(1)->0.5403023
  • Sin::Number->Number
    Trigonometric sin.
    Sin(1)->0.84147096
  • Tan::Number->Number
    Trigonometric tan.
    Tan(1)->1.5574077
  • Atan::Number->Number
    Trigonometric atan.
    Atan(1)->0.7853982
  • Abs::Number->Number
    Absolute value of a number.
    Abs(-3)->3
  • Sqrt::Number->Number
    The square root of a number.
  • ToText::Any->Text
    Convert an expression to readable text.
  • ToArray::Any->Array
    Wrap the given expression in an array.
  • IsValid::Any->Bool
    Returns true if the given expression can be evaluated successfully.
  • TextLength::Text->Number
    The length of the text in characters.
  • MapKeys::Map->Array
    An array of all of the keys in the a map.
  • MapKeysAndVals::Map->Array
    List the keys and values of a map.
  • Cells::Component->Map
    Convert a component into its cell definitions.
  • ArrayLength::Array->Number
    The length of the array in elements.
  • ArraySum::Array->Number
    Sum of all numbers in an arrray.
  • ArrayMax::Array->Number
    The maximum number in an array of numbers.
  • ArrayMin::Array->Number
    The minimum number in an array of numbers.
  • ArrayAccumulate::Array->Array
    The running sum of all of the numbers in an array.
  • ArrayReverse::Array->Array
    Reverses the elements in the array.
  • Transpose::matrix Array->Array
    Performs a matrix transpose operation on an array of arrays.
  • AppCell::idx Text->Any
    Reference a global application cell by name.
  • Negate::Number->Number
    Negate a number.
  • IsInteger::Number->Bool
    Returns true when the number is an integer (not a fraction).
  • ToInteger::num Number->Number
    Convert a fractional number into an integer.
  • ParseNumber::Text->Number
    Converts text into a number.
  • ToDefaultFunction::fn_name Text->Any
    Convert a function name into the default expression for that function.
  • AccessibleComponents::owned_only Text->Array
    An array of component ids which are currently accessible.
  • ComponentDocInfo::component_doc_id Text->Map
    Returns metadata about the component with the given component id.
  • BoolToInteger::bool Bool->Number
    Convert true to 1 and false to 0.
  • ReferencedComponentId::ComponentRef->Text
    The component id being referenced.
  • ReferencedOverrides::ComponentRef->Component
    The overrides set in the reference.
  • ReferenceType::ComponentRef->Text
    The type (mutable or immutable) of the reference.
  • EventHandlerLength::EventHandler->Number
    The number of matcher pairs in the given event handler.
  • DisplayCharacter::Text->Shape
    Convert a text character into a shape.
  • Radians::angle Number->Angle
    Get the size of the angle in radians.
  • AnchorToNode::node_path Array->Anchor
    Create an anchor to a specific node using a path.
  • EvalAs::cell Any->from Array->Any
    Evaluate an expression using the context of the node at the given path.
  • ParentCell::idx Text->jumps Number->Any
    Reference a cell in a parent component by name.
  • ChildCell::path Array->idx Text->Any
    Returns the value of a cell in a subcomponent.
  • ChildrenCells::idx Text->default Any->Array
    Returns an array of the values of the cell defined by all current subcomponents.
  • ParentCellAbsolutePath::idx Text->jumps Number->Array
    Get the absolute path of a cell in a parent component.
  • ChildCellAbsolutePath::relpath Array->idx Text->Array
    Get the absolute path of a cell in a subcomponent.
  • ComponentRef::id Text->overrides Component->ComponentRef
    Creates a ComponentRef from a component id and a set of overrides.
  • ForEachMap::to_iter Map->display Map|ComponentRef->Array
  • ForEachArray::to_iter Array->display Map|ComponentRef->Array
  • ForEachText::to_iter Text->display Map|ComponentRef->Array
  • IndexArray::index Number->array Array->Any
    Get the value at the given index from the array.
    IndexArray(2,
    ["A","B","C","D"]
    )
    ->"C"
  • IndexMap::key Text->map Map->Any
    Get the value stored at the given key of a map.
    IndexMap("A",
    "A"
    123
    "B"
    456
    )
    ->123
  • MapKeyAtIndex::index Number->map Map->Text
    Return the key associated to a given index of a map.
  • Try::try Any->default Any->Any
    Try returning the result from the expression. If that fails then return the default value.
  • And::Bool->Bool->Bool
    Logical AND.
  • Or::Bool->Bool->Bool
    Logical OR.
  • TextJoin::Text->Text->Text
    Join two texts together into a single text.
  • ArrayJoin::Array->Array->Array
    Join two arrays together into a single array.
  • Map1::fn Text->over Array->Array
    Apply a one-argument function to an array of values.
  • Eq::Any->Any->Bool
    Returns true when both argument expressions match. Does not evaluate the arguments.
  • IsGreater::a Number->b Number->Bool
    Returns true when a > b.
  • IsLess::a Number->b Number->Bool
    Returns true when a < b.
  • FilterByText::filter Text->array Array->Array
    Use some filter text to search for matches in an Array of Text.
  • Repeat::count Number->to_repeat Any->Array
    Repeats some value some number of times. Does not evaluate to_repeat.
  • ArrayPush::array Array->value Any->Array
    Insert an element at the end of an array.
  • ArrayRemove::array Array->index Number->Array
    Remove an element at a given index from the array.
  • ArrayDrop::array Array->count Number->Array
    Drop the last n elements from an array and return the remaining elements.
  • MakeMap::key Text->value Any->Map
    Create a new map using the provided key and value.
  • Max::a Number->b Number->Number
    Returns the larger value of a or b.
  • Min::a Number->b Number->Number
    Returns the smaller value of a or b.
  • Add::Number->Number->Number
    Add two numbers.
    Add(6, 3)->9
  • Subtract::a Number->b Number->Number
    The difference (a - b) between the numbers.
    Subtract(6, 3)->3
  • Multiply::Number->Number->Number
    Multiply two numbers.
    Multiply(6, 3)->18
  • Divide::Number->Number->Number
    Divide two numbers.
    Divide(6, 3)->2
  • Pow::base Number->exp Number->Number
    Raises the number to the given power.
    Pow(2, 3)->8
  • Modulo::base Number->mod Number->Number
    Mathematical modulo operation.
    Modulo(7, 3)->1
  • Atan2::x Number->y Number->Number
    Trigonometric atan2.
    Atan2(0, 1)->1.5707964
  • ArrayTakeFirst::count Number->array Array->Array
    Take the first n elements from the array.
    ArrayTakeFirst(3,
    ["a","b","c","d","e"]
    )
    ->
    ["a","b","c"]
  • ArraySkipFirst::count Number->array Array->Array
    Returns the input array with the first n elements dropped.
  • TextTakeFirst::count Number->text Text->Text
    Take the first n characters from some text.
  • TextSkipFirst::count Number->text Text->Text
    Returns the input text with the first n characters dropped.
  • ToTextShort::Any->maxlen Number->Text
    Convert an expression into a short readable display.
  • MatchText::matcher Map->key Text->Any
    Evaluate and return the expression at a given key in a map.
  • ColorWithSaturation::color Color->saturation Number->Color
    Saturate a color by some amount between -1 and 1.
  • ColorWithBrightness::color Color->brightness Number->Color
    Brighten a color by some amount between 1 and -1.
  • WithOverrides::to_override Map|ComponentRef->overrides Component->Map|ComponentRef
    Add cells to a component. Override cells on a ComponentRef.
  • TextSplit::text Text->pattern Text->Array
    Split the text using the specified pattern.
  • GetCursor::path Array->cursor name Text->Number
    Retrieve a cursor position by name.
  • MapFromZip::keys Array->values Array->Map
    Create a map by zipping a list of keys with list of values.
  • Range::start Number->end Number->Array
    List all numbers between a starting and ending number, incrementing by one. Contains all numbers incrementing by one where start <= x < end.
    Range(0, 3)->
    [0,1,2]
  • SubIndex::sub_index_type Text->value Any->SubIdx
    Create a sub-index literal using a type and and the expected arguments.
  • ExprRef::node_path Array->cell_index Text->sub_index Array->Any
    Reference an expression at some sub-index of a cells value.
  • If::cond Bool->then Any->else Any->Any
    If the condition is true then return the second argument; otherwise, return the third argument.
  • MapInsert::map Map->key Text->val Any->Map
    Insert the value into the map at the given key.
  • Map2::fn Text->arg Any->over Array->Array
    Apply a two-argument function to an array of values using the supplied value as the first argument.
  • ArraySet::array Array->idx Number->val Any->Array
    Set the value at the given index of an array.
  • Clamp::min Number->val Number->max Number->Number
    Returns some value clamped between a minimum and maximum.
    Clamp(0, 2, 1)->1