Thank you for being patient! We're working hard on resolving the issue
Welcome to the Lona Lisp documentation. This guide covers the core concepts and features of the Lisp implementation used in Lona.
Lona includes a built-in Lisp interpreter that allows you to write powerful automation scripts and extensions. This documentation provides a comprehensive reference for the language and its features.
All examples in this guide are interactive - click "Run" to execute them and see the results!
Try your first Lisp expression:
Lisp code is written using S-expressions (symbolic expressions). An S-expression is either an atom or a list.
Lists are the fundamental data structure in Lisp. They can be created using the
list function or quoted notation:
Lona Lisp supports both integers and floating-point numbers:
Strings are enclosed in double quotes:
You can get the length of a string:
Symbols are identifiers that can be quoted:
Use define to create variables:
Variables can be used in expressions:
Functions can be defined using the shorthand syntax:
Functions can call themselves recursively:
Lambda functions create anonymous functions:
The if expression evaluates a condition and returns one of two values:
If expressions can be nested:
Use begin to execute multiple expressions in sequence:
Create local variable bindings with let:
Let bindings can be nested:
Pattern matching with match:
Addition with multiple values:
Subtraction:
Multiplication:
Division (returns decimals):
Modulo operation:
Complex nested arithmetic:
Equality:
Inequality:
Less than and greater than:
Less than or equal, greater than or equal:
Vectors are ordered collections created with square brackets or the vector
function:
Get the count of elements:
Check if a vector is empty:
Get an element by index:
Add elements with conj:
Nested vectors:
Maps are key-value collections created with curly braces or the hash-map
function:
Get the count of key-value pairs:
Get a value by key:
Add or update key-value pairs with assoc:
Remove keys with dissoc:
Get all keys:
Get all values:
Nested maps:
Map a function over a collection:
Functions can call each other recursively:
Combining let bindings with collections:
Calculate powers using recursion:
Sheet Lisp extends the standard Lisp library with functions for working with sheet data. These functions provide access to row values, date information, and cell styling.
You can reference other rows in formulas using bracket notation:
By row name: rows["Row Name"]
By row lookup key: rows["lookup-key"]
The referenced row returns its computed value for the current column (time period).
Sheet Lisp provides access to the current column's date information:
Returns the date string for the current column:
Returns the day of week as a short name (Mon, Tue, etc.):
Returns the ISO day of week as a number (1 = Monday, 7 = Sunday):
Returns a list of day-of-week short names for all days in the column range:
Returns a list of ISO day-of-week numbers for all days in the column range:
Returns the day of month (1-31):
Returns a list of day-of-month values for all days in the column range:
Returns the week-since-epoch value:
Returns a list of week-since-epoch values for all days in the column range:
Returns the day-since-epoch value:
Returns the ISO week number (1-53):
Returns a list of hours per day for the column range (useful for DST transitions):
Returns the year of the column:
Returns the timezone name:
Sets the background color of the current cell:
Pass nil to clear the background:
With index for multi-value cells:
Calculate the number of days remaining until the end of the year for the current
column. Uses date.doy.end to get the day-of-year for the last day in the
column range, which works correctly for days, weeks, months, or years:
Calculate the number of days remaining until the end of the month for the
current column. Uses date.dom.end to get the day-of-month for the last day in
the column range, which works correctly for days, weeks, or months:
Calculate the number of workdays (Monday-Friday) remaining until the end of the
year. Uses date.dow.end to get the day of week for the last day in the column
range (0=Mon, 6=Sun), then calculates full weeks × 5 plus partial week workdays:
Highlight weekend cells with an orange background. Uses date.dow.0 to check if
the column falls on Saturday (5) or Sunday (6):
Extract fields from a row containing JSON data (like weather data) and perform
transformations. The weather API returns nested data with a day object containing
temperature, humidity, and condition information. Use json-get-in to access nested
properties:
Access deeply nested properties using json-get-in with a path array: