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.
  • ThisNodePath::AbsoluteNodePath
    Get the absolute path of the evaluating node.
  • IsHovered::Bool
    True when the cursor is hovered over the node.
  • Cell::idx Text->Any
    Reference a cell by name.
  • AbsoluteCellExpression::path AbsoluteCellPath->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.
  • EvalAsSource::to_eval Any->Any
    Evaluate an expression using in context of its source.
  • EvalContainer::container Any->Any
    Evaluate each expression in a container. Returns the same container, but each value is the result from evaluating.
    ->
    "A"
    3
    "B"
    18
  • NodeChildrenInfo::path AbsoluteNodePath->Map
    Get information about the subcomponents of a node.
  • NodeCellsInfo::path AbsoluteNodePath->Array
    Information about the cells defined on a node.
  • NodeGeneratedBy::path AbsoluteNodePath->View
    The view generating a node in the UI.
  • CellAbsolutePath::Text->AbsoluteCellPath
    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!"
  • ExpressionType::expr Any->Type
    Get the type of some expression.
  • Not::Bool->Bool
    Logical NOT.
    Not
    true
    ->false
  • Cos::Number->Number
    Trigonometric cos.
    ->0.540302
  • Sin::Number->Number
    Trigonometric sin.
    ->0.841471
  • Tan::Number->Number
    Trigonometric tan.
    ->1.557408
  • Atan::Number->Number
    Trigonometric atan.
    ->0.785398
  • Abs::Number->Number
    Absolute value of a number.
    Abs
    -3
    ->3
  • Sqrt::Number->Number
    The square root of a number.
    ->2
  • ToText::Any->Text
    Convert a value to readable text.
    ->"3"
  • ToArray::Any->Array
    Creates a new Array with a single value.
    ->
    [3]
  • 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|CellMap->Array
    An array of all of the keys in the a map.
  • MapKeysAndVals::Map->Array
    List the keys and values of a map.
  • ArrayLength::Array->Number
    The length of the array in elements.
  • NoteLength::Workspace->Number
    The number of blocks in the note.
  • NodePathLength::AbsoluteNodePath->Number
    The length (depth) of the node path.
  • 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.
    ->123
  • AccessibleDocuments::owned_only Text->Array
    An array of doc ids which are currently accessible.
  • DocumentTitle::doc_id Text->Text
    Returns the user-defined title of the document.
  • DocumentValue::doc_id Text->Any
    Gets the current value of a document.
  • DocumentType::doc_id Text->Type
    Returns the type of the doc.
  • DocumentIsStarred::doc_id DocId->Bool
    Returns whether or not the document is starred/favorited locally.
  • BoolToInteger::bool Bool->Number
    Convert true to 1 and false to 0.
  • ViewDocumentId::View->Text
    The id of the component document being referenced.
  • ViewOverrides::View->CellMap
    The overrides set in the view.
  • EventHandlerLength::EventHandler->Number
    The number of matcher pairs in the given event handler.
  • GlyphShape::Text->Shape
    Convert a text character into a shape.
  • Radians::angle Number->Angle
    Get the size of the angle in radians.
  • AnchorToNode::node_path AbsoluteNodePath->Anchor
    Create an anchor to a specific node using a path.
  • ParseMarkdown::markdown Text->Markdown
    Parse text into a markdown.
  • ViewMarkdown::markdown Markdown->View
    Component to view parsed markdown as formatted text.
  • TableColumns::Table->Array
    An array of all column names in the table.
  • TableRows::Table->Array
    A 2d array of the data in the table.
  • OverrideableCells::component Component->Array
    List the cells in the component which are marked as overrideable.
  • DocumentSyncStatus::doc DocId->Array
    The sync status of the given document.
  • NoteBlocks::Workspace->Array
    The array of Views blocks.
  • EvalChildren::children Any->Any
    Evaluates each expression in the container, then evaluates views.
  • IsImmutable::view View->Bool
    Returns true if the view is mutable.
  • NodeCellMap::path AbsoluteNodePath->Any
    The CellMap which defines the node.
  • 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.
  • AbsoluteCell::node_path AbsoluteNodePath->cell_index Text->Any
    The value of the cell at the given absolute path.
  • ParentCellAbsolutePath::idx Text->jumps Number->AbsoluteCellPath
    Get the absolute path of a cell in a parent component.
  • ChildCellAbsolutePath::relpath Array->idx Text->AbsoluteCellPath
    Get the absolute path of a cell in a subcomponent.
  • View::id Text->overrides CellMap->View
    Creates a view from a component doc and a set of overrides.
  • ForEachMap::to_iter Map->display Map|View->Array
  • ForEachArray::to_iter Array->display Map|View->Array
  • ForEachText::to_iter Text->display Map|View->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|CellMap->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.
  • RepeatText::count Number->text Text->Text
    Repeats the given text a number of times.
  • 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
    Subtract two numbers (a - b).
  • Multiply::Number->Number->Number
    Multiply two numbers.
    ->18
  • Divide::Number->Number->Number
    Divide two numbers.
    ->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.
    ->1
  • Atan2::x Number->y Number->Number
    Trigonometric atan2.
    ->1.570796
  • 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|View->overrides CellMap->Map|View
    Sets cells on a component. Sets overrides on a View.
  • TextSplit::text Text->pattern Text->Array
    Split the text using the specified pattern.
  • GetCursor::cell_index Text->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.
    ->
    [0,1,2]
  • ParentNodePath::node_path AbsoluteNodePath->jumps Number->AbsoluteNodePath
    Get the parent path of a given node path.
  • ExtendNodePath::node_path AbsoluteNodePath->child_node_index Text->AbsoluteNodePath
    Extend a node path to a child node.
  • ExtendNodePathMulti::node_path AbsoluteNodePath->child_path Array->AbsoluteNodePath
    Get the path of a child node of the given node path.
  • MarksAt::text Text->index Number->Array
    Get the styling marks which apply to a given character in some text.
  • ArrayContains::Array->element Any->Bool
    Returns true if the array contains the given element.
  • Index::value Any->index ExprIndex->Any
    Get the value at the given index.
    Index
    ["A","B","C","D"]
    2
    ->"C"
  • NewIndex::index_type Text->value Any->ExprIndex
    Create a sub-index literal using a type and and the expected arguments.
  • 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.
    ->1
  • IndexTable::table Table->column Text->row Number->Any
    Get a value stored in a table.
  • Subtext::text Text->start Number->end Number->Text
    The text from between a starting character index and ending character index.
    Subtext
    "hello"
    1
    3
    ->"el"
  • TextShape::font_size Number->line_height Number->text Text->Shape
    Convert some text into a displayable shape.