Documentation

Data: math, strings, arrays, objects

Every operator a .lolo program can call, from the canonical registry the compiler bakes.

Namespaces on this page: array/, data/, json/, math/, object/, path/, str/.

array/

array/append

Add item to end (returns new array)

lolo
1 (array/append arr item)

Parameters

NameTypeDescription
arrarrayThe array
itemanyItem to add

Returns: array

Example

lolo
1 (array/append [1 2] 3) // => [1, 2, 3]

array/avg

Average of values (optionally by field)

lolo
1 (array/avg arr key)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to average

Returns: number

Example

lolo
1 (array/avg [{"score":80},{"score":90}] "score")

array/concat

Concatenate arrays

lolo
1 (array/concat ...arrs)

Parameters

NameTypeDescription
...arrsarray[]Arrays to concatenate

Returns: array

Example

lolo
1 (array/concat [1 2] [3 4]) // => [1, 2, 3, 4]

array/cosine

Cosine similarity between two numeric vectors, in [-1, 1] (1 = identical direction). The building block for "is this answer semantically the reference answer" checks over embeddings. Pure math — usable in guards and value position, unlike the async llm/* substrate operators.

lolo
1 (array/cosine v1 v2)

Parameters

NameTypeDescription
v1arrayFirst numeric vector
v2arraySecond numeric vector

Returns: number

Example

lolo
1 (array/cosine [1 0] [1 0]) // => 1

array/count

Count elements (optionally matching predicate)

lolo
1 (array/count arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: number

Example

lolo
1 (array/count [{"status":"done"},{"status":"todo"}] ["fn","t",["=","@t.status","done"]])

array/drop

Skip first n elements

lolo
1 (array/drop arr n)

Parameters

NameTypeDescription
arrarrayThe array
nnumberNumber of elements to skip

Returns: array

Example

lolo
1 (array/drop [1,2,3,4,5,6,7] 5)

array/dropLast

Skip last n elements

lolo
1 (array/dropLast arr n)

Parameters

NameTypeDescription
arrarrayThe array
nnumberNumber of elements to skip

Returns: array

Example

lolo
1 (array/dropLast [1,2,3,4,5] 2)

array/every

Check if all elements match predicate

lolo
1 (array/every arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: boolean

Example

lolo
1 (array/every [{"price":5},{"price":10}] ["fn","x",[">","@x.price",0]])

array/filter

Keep elements matching predicate (returns same array element type as input)

lolo
1 (array/filter arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: array

Example

lolo
1 (array/filter [{"price":50},{"price":150}] ["fn","x",[">","@x.price",100]])

array/find

Find first element matching predicate (element type of input array, undefined when no match)

lolo
1 (array/find arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: any

Example

lolo
1 (array/find [{"status":"active"},{"status":"archived"}] ["fn","x",["=","@x.status","active"]])

array/findIndex

Find index of first element matching predicate (-1 if none)

lolo
1 (array/findIndex arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: number

Example

lolo
1 (array/findIndex [{"status":"active"},{"status":"archived"}] ["fn","x",["=","@x.status","active"]])

array/first

Get first element (element type of input array, may be undefined when empty)

lolo
1 (array/first arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: any

Example

lolo
1 (array/first [1 2 3]) // => 1

array/flatten

Flatten nested arrays one level

lolo
1 (array/flatten arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: array

Example

lolo
1 (array/flatten [[1 2] [3 4]]) // => [1, 2, 3, 4]

array/groupBy

Group elements by field value

lolo
1 (array/groupBy arr key)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to group by

Returns: any

Example

lolo
1 (array/groupBy [{"status":"new"},{"status":"done"}] "status")

array/includes

Check if array contains item

lolo
1 (array/includes arr item)

Parameters

NameTypeDescription
arrarrayThe array
itemanyItem to find

Returns: boolean

Example

lolo
1 (array/includes [1 2 3] 2) // => true

array/indexOf

Find index of item (-1 if not found)

lolo
1 (array/indexOf arr item)

Parameters

NameTypeDescription
arrarrayThe array
itemanyItem to find

Returns: number

Example

lolo
1 (array/indexOf [1 2 3] 2) // => 1

array/insert

Insert item at index (returns new array)

lolo
1 (array/insert arr index item)

Parameters

NameTypeDescription
arrarrayThe array
indexnumberIndex to insert at
itemanyItem to insert

Returns: array

Example

lolo
1 (array/insert [1 3] 1 2) // => [1, 2, 3]

array/last

Get last element (element type of input array, may be undefined when empty)

lolo
1 (array/last arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: any

Example

lolo
1 (array/last [1 2 3]) // => 3

array/len

Array length

lolo
1 (array/len arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: number

Example

lolo
1 (array/len [1 2 3]) // => 3

array/map

Transform each element (return type wraps the lambda result in an array)

lolo
1 (array/map arr fn)

Parameters

NameTypeDescription
arrarrayThe array
fnlambdaTransform function

Returns: array

Example

lolo
1 (array/map [{"price":100},{"price":200}] ["fn","x",["*","@x.price",1.1]])

array/max

Maximum value (optionally by field)

lolo
1 (array/max arr key)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to compare

Returns: number

Example

lolo
1 (array/max [{"price":3},{"price":9}] "price")

array/min

Minimum value (optionally by field)

lolo
1 (array/min arr key)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to compare

Returns: number

Example

lolo
1 (array/min [{"price":3},{"price":9}] "price")

array/nearest

Find the candidate vector nearest a query vector by cosine similarity. Returns { index, score, margin } — index/score of the best match, and margin (best score minus second-best), which is what makes an abstaining gate possible: a small margin means the top match is not confidently distinguished from the runner-up.

lolo
1 (array/nearest query candidates)

Parameters

NameTypeDescription
queryarrayQuery vector
candidatesarrayArray of candidate vectors

Returns: object

Example

lolo
1 (array/nearest [1 0] [[1 0] [0 1]]) // => {"index": 0, "score": 1, "margin": 1}

array/nth

Get element at index (element type of input array, may be undefined out-of-bounds)

lolo
1 (array/nth arr index)

Parameters

NameTypeDescription
arrarrayThe array
indexnumberIndex (0-based)

Returns: any

Example

lolo
1 (array/nth [1 2 3] 1) // => 2

array/partition

Split array by predicate into [matches, nonMatches]

lolo
1 (array/partition arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: array

Example

lolo
1 (array/partition [{"price":30},{"price":80}] ["fn","x",[">","@x.price",50]])

array/prepend

Add item to start (returns new array)

lolo
1 (array/prepend arr item)

Parameters

NameTypeDescription
arrarrayThe array
itemanyItem to add

Returns: array

Example

lolo
1 (array/prepend [2 3] 1) // => [1, 2, 3]

array/range

Generate numbers: (range n) => [0,n); (range start end) => [start,end); optional step

lolo
1 (array/range n)

Parameters

NameTypeDescription
nnumberUpper bound or length (variadic)

Returns: array

Example

lolo
1 (array/range 3) // => [0 1 2]

array/reduce

Reduce array to single value (return type matches the lambda result / init type)

lolo
1 (array/reduce arr fn init)

Parameters

NameTypeDescription
arrarrayThe array
fnlambdaReducer function (acc, item) => newAcc
initanyInitial accumulator value

Returns: any

Example

lolo
1 (array/reduce [{"price":10},{"price":25}] 0 ["fn",["acc","x"],["+","@acc","@x.price"]])

array/reject

Remove elements matching predicate (returns same array element type as input)

lolo
1 (array/reject arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: array

Example

lolo
1 (array/reject [{"status":"active"},{"status":"deleted"}] ["fn","x",["=","@x.status","deleted"]])

array/remove

Remove item at index (returns new array)

lolo
1 (array/remove arr index)

Parameters

NameTypeDescription
arrarrayThe array
indexnumberIndex to remove

Returns: array

Example

lolo
1 (array/remove [1 2 3] 1) // => [1, 3]

array/removeItem

Remove first matching item (returns new array)

lolo
1 (array/removeItem arr item)

Parameters

NameTypeDescription
arrarrayThe array
itemanyItem to remove

Returns: array

Example

lolo
1 (array/removeItem [1 2 3 2] 2) // => [1, 3, 2]

array/reverse

Reverse array order (returns new array)

lolo
1 (array/reverse arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: array

Example

lolo
1 (array/reverse [1 2 3]) // => [3, 2, 1]

array/shuffle

Randomly shuffle array (returns new array)

lolo
1 (array/shuffle arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: array

Example

lolo
1 (array/shuffle [1 2 3 4 5])

array/slice

Extract subarray

lolo
1 (array/slice arr start end)

Parameters

NameTypeDescription
arrarrayThe array
startnumberStart index
endnumberEnd index (exclusive)

Returns: array

Example

lolo
1 (array/slice [1 2 3 4] 1 3) // => [2, 3]

array/some

Check if any element matches predicate

lolo
1 (array/some arr pred)

Parameters

NameTypeDescription
arrarrayThe array
predlambdaPredicate function

Returns: boolean

Example

lolo
1 (array/some [{"status":"archived"},{"status":"active"}] ["fn","x",["=","@x.status","active"]])

array/sort

Sort array (returns new array)

lolo
1 (array/sort arr key dir)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to sort by (for objects)
dirstring"asc" or "desc"

Returns: array

Example

lolo
1 (array/sort [{"price":3},{"price":9},{"price":5}] "price" "desc")

array/sum

Sum values (optionally by field)

lolo
1 (array/sum arr key)

Parameters

NameTypeDescription
arrarrayThe array
keystringField to sum

Returns: number

Example

lolo
1 (array/sum [{"price":10},{"price":25}] "price")

array/take

Take first n elements

lolo
1 (array/take arr n)

Parameters

NameTypeDescription
arrarrayThe array
nnumberNumber of elements

Returns: array

Example

lolo
1 (array/take [1,2,3,4,5,6,7] 5)

array/takeLast

Take last n elements

lolo
1 (array/takeLast arr n)

Parameters

NameTypeDescription
arrarrayThe array
nnumberNumber of elements

Returns: array

Example

lolo
1 (array/takeLast [1,2,3,4,5] 3)

array/unique

Remove duplicates (returns new array)

lolo
1 (array/unique arr)

Parameters

NameTypeDescription
arrarrayThe array

Returns: array

Example

lolo
1 (array/unique [1 2 2 3 1]) // => [1, 2, 3]

array/zip

Pair elements from two arrays

lolo
1 (array/zip arr1 arr2)

Parameters

NameTypeDescription
arr1arrayFirst array
arr2arraySecond array

Returns: array

Example

lolo
1 (array/zip [1 2] (a "b")) // => [[1, "a"], [2, "b"]]

data/

data/augment

Apply data augmentation

lolo
1 (data/augment data config)

Parameters

NameTypeDescription
dataobjectData object
configobjectAugmentation config

Returns: object

Example

lolo
1 (data/augment [[1.0,2.0],[3.0,4.0]] {"flip":true,"rotate":15}) // => {}

data/dataloader

Create batched dataloader from dataset

lolo
1 (data/dataloader dataset batchSize)

Parameters

NameTypeDescription
datasetobjectDataset to load
batchSizenumberBatch size

Returns: object

Example

lolo
1 (data/dataloader ["data/dataset",[[1,2],[3,4],[5,6]],{}] {"batch-size":2,"shuffle":true})

data/dataset

Create dataset from entity collection and contracts

lolo
1 (data/dataset entities schema)

Parameters

NameTypeDescription
entitiesarrayEntity collection
schemaobjectData schema

Returns: object

Example

lolo
1 (data/dataset [{"x":1,"y":2}] {"input":{"fields":["x"]},"output":{"fields":["y"]}})

data/normalize

Normalize features (mean/std or min/max)

lolo
1 (data/normalize tensor mode)

Parameters

NameTypeDescription
tensorobjectInput tensor
modestringNormalization mode

Returns: tensor

Example

lolo
1 (data/normalize [[1,2],[3,4]] {"method":"standard"})

data/pad

Pad sequences to uniform length

lolo
1 (data/pad sequences maxLen)

Parameters

NameTypeDescription
sequencesarraySequences to pad
maxLennumberTarget length

Returns: tensor

Example

lolo
1 (data/pad [[1,2,3],[4,5]] {"max-length":4,"pad-value":0})

data/split

Train/validation split. Config carries trainRatio (default 0.8); the remainder is the validation split.

lolo
1 (data/split dataset config)

Parameters

NameTypeDescription
datasetobjectDataset to split
configobjectSplit config

Returns: array

Example

lolo
1 (data/split ["data/dataset",[1,2,3,4,5],{}] {"trainRatio":0.8})

data/tokenize

Tokenize text fields

lolo
1 (data/tokenize texts vocab)

Parameters

NameTypeDescription
textsarrayTexts to tokenize
vocabobjectVocabulary mapping

Returns: tensor

Example

lolo
1 (data/tokenize "hello world" {"method":"bpe","max-length":512})

json/

json/parse

Parse a JSON string into a value; invalid JSON or non-string input returns null (never throws)

lolo
1 (json/parse s)

Parameters

NameTypeDescription
sstringThe JSON string to parse

Returns: any

Example

lolo
1 (json/parse "{\"a\": 1}") // => {a: 1}

json/stringify

Serialize any value to a JSON string

lolo
1 (json/stringify v)

Parameters

NameTypeDescription
vanyThe value to serialize

Returns: string

Example

lolo
1 ["json/stringify", {a: 1}] // => "{\"a\":1}"

math/

math/abs

Absolute value

lolo
1 (math/abs n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/abs -5) // => 5

math/acos

Arccosine (inverse cosine) in radians

lolo
1 (math/acos x)

Parameters

NameTypeDescription
xnumberInput value between -1 and 1

Returns: number

Example

lolo
1 (math/acos 0.5) // => 1.0472

math/approach

Move cur toward target by at most maxDelta

lolo
1 (math/approach cur target max)

Parameters

NameTypeDescription
curnumberCurrent value
targetnumberTarget value
maxnumberMaximum delta per step

Returns: number

Example

lolo
1 (math/approach 10 20 3) // => 13

math/asin

Arcsine (inverse sine) in radians

lolo
1 (math/asin x)

Parameters

NameTypeDescription
xnumberInput value between -1 and 1

Returns: number

Example

lolo
1 (math/asin 0.5) // => 0.5236

math/atan

Arctangent (inverse tangent) in radians

lolo
1 (math/atan x)

Parameters

NameTypeDescription
xnumberInput value

Returns: number

Example

lolo
1 (math/atan 1) // => 0.7854

math/atan2

Angle in radians from the positive x-axis to point (x, y)

lolo
1 (math/atan2 y x)

Parameters

NameTypeDescription
ynumberY coordinate
xnumberX coordinate

Returns: number

Example

lolo
1 (math/atan2 1 1) // => 0.7854

math/ceil

Round up to integer

lolo
1 (math/ceil n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/ceil 3.2) // => 4

math/clamp

Constrain value to range [min, max]

lolo
1 (math/clamp n min max)

Parameters

NameTypeDescription
nnumberThe value to clamp
minnumberMinimum bound
maxnumberMaximum bound

Returns: number

Example

lolo
1 (math/clamp 150 0 100) // => 100

math/cos

Cosine of an angle in radians

lolo
1 (math/cos radians)

Parameters

NameTypeDescription
radiansnumberAngle in radians

Returns: number

Example

lolo
1 (math/cos 0) // => 1

math/default

Return default if value is null, undefined, or NaN

lolo
1 (math/default default)

Parameters

NameTypeDescription
defaultnumberDefault value

Returns: number

Example

lolo
1 (math/default null 0) // => 0

math/deg-rad

Convert degrees to radians

lolo
1 (math/deg-rad degrees)

Parameters

NameTypeDescription
degreesnumberAngle in degrees

Returns: number

Example

lolo
1 (math/deg-rad 180) // => 3.1416

math/floor

Round down to integer

lolo
1 (math/floor n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/floor 3.7) // => 3

math/hypot

Euclidean length sqrt(a²+b²)

lolo
1 (math/hypot a b)

Parameters

NameTypeDescription
anumberFirst side
bnumberSecond side

Returns: number

Example

lolo
1 (math/hypot 3 4) // => 5

math/lerp

Linear interpolation between a and b by factor t

lolo
1 (math/lerp a b t)

Parameters

NameTypeDescription
anumberStart value
bnumberEnd value
tnumberInterpolation factor (0-1)

Returns: number

Example

lolo
1 (math/lerp 0 100 0.5) // => 50

math/ln

Natural logarithm (base e)

lolo
1 (math/ln n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/ln 2.718281828) // => 1

math/log10

Base-10 logarithm

lolo
1 (math/log10 n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/log10 100) // => 2

math/map

Map value from one range to another

lolo
1 (math/map n inMin inMax outMin outMax)

Parameters

NameTypeDescription
nnumberThe value
inMinnumberInput range minimum
inMaxnumberInput range maximum
outMinnumberOutput range minimum
outMaxnumberOutput range maximum

Returns: number

Example

lolo
1 (math/map 5 0 10 0 100) // => 50

math/max

Maximum of values

lolo
1 (math/max ...nums)

Parameters

NameTypeDescription
...numsnumber[]Numbers to compare

Returns: number

Example

lolo
1 (math/max 3 1 4) // => 4

math/min

Minimum of values

lolo
1 (math/min ...nums)

Parameters

NameTypeDescription
...numsnumber[]Numbers to compare

Returns: number

Example

lolo
1 (math/min 3 1 4) // => 1

math/mod

Modulo (remainder)

lolo
1 (math/mod a b)

Parameters

NameTypeDescription
anumberDividend
bnumberDivisor

Returns: number

Example

lolo
1 (math/mod 7 3) // => 1

math/pow

Exponentiation (base^exp)

lolo
1 (math/pow base exp)

Parameters

NameTypeDescription
basenumberThe base
expnumberThe exponent

Returns: number

Example

lolo
1 (math/pow 2 8) // => 256

math/rad-deg

Convert radians to degrees

lolo
1 (math/rad-deg radians)

Parameters

NameTypeDescription
radiansnumberAngle in radians

Returns: number

Example

lolo
1 (math/rad-deg 3.1416) // => 180

math/random

Random number between 0 (inclusive) and 1 (exclusive)

lolo
1 (math/random)

Returns: number

Example

lolo
1 (math/random) // => 0.7234...

math/randomInt

Random integer in range [min, max] (inclusive)

lolo
1 (math/randomInt min max)

Parameters

NameTypeDescription
minnumberMinimum (inclusive)
maxnumberMaximum (inclusive)

Returns: number

Example

lolo
1 (math/randomInt 1 6) // => 4

math/round

Round to nearest integer or specified decimals

lolo
1 (math/round n decimals)

Parameters

NameTypeDescription
nnumberThe number
decimalsnumberDecimal places

Returns: number

Example

lolo
1 (math/round 3.456 2) // => 3.46

math/sign

Returns -1, 0, or 1 indicating sign

lolo
1 (math/sign n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/sign -42) // => -1

math/sin

Sine of an angle in radians

lolo
1 (math/sin radians)

Parameters

NameTypeDescription
radiansnumberAngle in radians

Returns: number

Example

lolo
1 (math/sin 1.5708) // => 1

math/sqrt

Square root

lolo
1 (math/sqrt n)

Parameters

NameTypeDescription
nnumberThe number

Returns: number

Example

lolo
1 (math/sqrt 16) // => 4

math/tan

Tangent of an angle in radians

lolo
1 (math/tan radians)

Parameters

NameTypeDescription
radiansnumberAngle in radians

Returns: number

Example

lolo
1 (math/tan 0.7854) // => 1

math/wrap

Wrap a value into the half-open range [min, max)

lolo
1 (math/wrap value min max)

Parameters

NameTypeDescription
valuenumberValue to wrap
minnumberMinimum bound
maxnumberMaximum bound

Returns: number

Example

lolo
1 (math/wrap 15 0 10) // => 5

object/

object/clone

Shallow clone object

lolo
1 (object/clone obj)

Parameters

NameTypeDescription
objobjectThe object

Returns: any

Example

lolo
1 (object/clone {"a":1,"b":2})

object/deepClone

Deep clone object

lolo
1 (object/deepClone obj)

Parameters

NameTypeDescription
objobjectThe object

Returns: any

Example

lolo
1 (object/deepClone {"a":{"b":2}})

object/deepMerge

Deep merge objects (later wins)

lolo
1 (object/deepMerge ...objs)

Parameters

NameTypeDescription
...objsobject[]Objects to merge

Returns: any

Example

lolo
1 (object/deepMerge {"a": {"b": 1}} {"a": {"c": 2}})

object/entries

Get [key, value] pairs as array

lolo
1 (object/entries obj)

Parameters

NameTypeDescription
objobjectThe object

Returns: array

Example

lolo
1 (object/entries {"a": 1}) // => [["a", 1]]

object/equals

Deep equality check

lolo
1 (object/equals a b)

Parameters

NameTypeDescription
aobjectFirst object
bobjectSecond object

Returns: boolean

Example

lolo
1 (object/equals {"a": 1} {"a": 1}) // => true

object/filter

Filter entries by predicate

lolo
1 (object/filter obj pred)

Parameters

NameTypeDescription
objobjectThe object
predlambdaPredicate (key, value) => boolean

Returns: any

Example

lolo
1 (object/filter {"a":1,"b":null} ["fn",["k","v"],["!=","@v",null]])

object/fromEntries

Create object from [key, value] pairs

lolo
1 (object/fromEntries entries)

Parameters

NameTypeDescription
entriesarrayArray of [key, value] pairs

Returns: any

Example

lolo
1 (object/fromEntries [["a" 1] ["b" 2]]) // => {"a": 1, "b": 2}

object/get

Get nested value by path (return type derived from input object shape and key)

lolo
1 (object/get obj path default)

Parameters

NameTypeDescription
objobjectThe object
pathstringDot-separated path (e.g., "user.name")
defaultanyDefault if path not found

Returns: any

Example

lolo
1 (object/get {"profile":{"name":"Ann"}} "profile.name" "Anonymous")

object/has

Check if path exists

lolo
1 (object/has obj path)

Parameters

NameTypeDescription
objobjectThe object
pathstringDot-separated path

Returns: boolean

Example

lolo
1 (object/has {"profile":{"name":"Ann"}} "profile.name")

object/keys

Get object keys as array

lolo
1 (object/keys obj)

Parameters

NameTypeDescription
objobjectThe object

Returns: array

Example

lolo
1 (object/keys {"a":1,"b":2}) // => ["a", "b"]

object/mapKeys

Transform all keys

lolo
1 (object/mapKeys obj fn)

Parameters

NameTypeDescription
objobjectThe object
fnlambdaTransform function

Returns: any

Example

lolo
1 (object/mapKeys {"a":1,"b":2} ["fn","k",["str/upper","@k"]])

object/mapValues

Transform all values

lolo
1 (object/mapValues obj fn)

Parameters

NameTypeDescription
objobjectThe object
fnlambdaTransform function

Returns: any

Example

lolo
1 (object/mapValues {"a":0.5,"b":0.25} ["fn","v",["*","@v",100]])

object/merge

Shallow merge objects (later wins)

lolo
1 (object/merge ...objs)

Parameters

NameTypeDescription
...objsobject[]Objects to merge

Returns: any

Example

lolo
1 (object/merge {"a": 1} {"b": 2}) // => {"a": 1, "b": 2}

object/omit

Exclude specified keys

lolo
1 (object/omit obj keys)

Parameters

NameTypeDescription
objobjectThe object
keysarrayKeys to exclude

Returns: any

Example

lolo
1 (object/omit {"name":"Ann","password":"x"} ["password"])

object/pick

Select only specified keys (return type is subset of input object shape)

lolo
1 (object/pick obj keys)

Parameters

NameTypeDescription
objobjectThe object
keysarrayKeys to keep

Returns: any

Example

lolo
1 (object/pick {"name":"Ann","email":"ann@example.com","age":30} ["name","email"])

object/set

Set nested value by path (returns new object)

lolo
1 (object/set obj path value)

Parameters

NameTypeDescription
objobjectThe object
pathstringDot-separated path
valueanyValue to set

Returns: any

Example

lolo
1 (object/set {"profile":{"name":"Ann"}} "profile.name" "John")

object/values

Get object values as array

lolo
1 (object/values obj)

Parameters

NameTypeDescription
objobjectThe object

Returns: array

Example

lolo
1 (object/values {"a":1,"b":2}) // => [1, 2]

path/

path/astar

A* shortest path on a w×h grid; returns cells start→goal (incl. both) or [] if none

lolo
1 (path/astar width height grid start goal)

Parameters

NameTypeDescription
widthnumberGrid width
heightnumberGrid height
gridarrayGrid data
startarrayStart coordinates
goalarrayGoal coordinates (variadic)

Returns: array

Example

lolo
1 (path/astar {"x":0,"y":0} {"x":2,"y":0} [] 3 1)

path/reachable

BFS cells reachable within N moves from start (incl. start); sorted row-major

lolo
1 (path/reachable width height grid start moves)

Parameters

NameTypeDescription
widthnumberGrid width
heightnumberGrid height
gridarrayGrid data
startarrayStart coordinates
movesnumberMaximum moves (variadic)

Returns: array

Example

lolo
1 (path/reachable {"x":1,"y":1} 1 [] 3 3 false)

str/

str/camelCase

Convert to camelCase

lolo
1 (str/camelCase s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/camelCase "hello world") // => "helloWorld"

str/capitalize

Capitalize first character

lolo
1 (str/capitalize s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/capitalize "hello") // => "Hello"

str/concat

Concatenate strings together

lolo
1 (str/concat str)

Parameters

NameTypeDescription
strstringString to concatenate (variadic)

Returns: string

Example

lolo
1 (str/concat "Hello" " " "World") // => "Hello World"

str/default

Return default if value is null/undefined/empty

lolo
1 (str/default default)

Parameters

NameTypeDescription
defaultstringDefault value

Returns: string

Example

lolo
1 (str/default null "N/A") // => "N/A"

str/endsWith

Check if string ends with suffix

lolo
1 (str/endsWith s suffix)

Parameters

NameTypeDescription
sstringThe string
suffixstringSuffix to check

Returns: boolean

Example

lolo
1 (str/endsWith "hello" "lo") // => true

str/includes

Check if string contains substring

lolo
1 (str/includes s search)

Parameters

NameTypeDescription
sstringThe string
searchstringSubstring to find

Returns: boolean

Example

lolo
1 (str/includes "hello world" "world") // => true

str/join

Join array elements into string

lolo
1 (str/join arr delim)

Parameters

NameTypeDescription
arrarrayArray to join
delimstringDelimiter

Returns: string

Example

lolo
1 (str/join (a "b" "c") ", ") // => "a, b, c"

str/kebabCase

Convert to kebab-case

lolo
1 (str/kebabCase s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/kebabCase "Hello World") // => "hello-world"

str/len

String length

lolo
1 (str/len s)

Parameters

NameTypeDescription
sstringThe string

Returns: number

Example

lolo
1 (str/len "hello") // => 5

str/lower

Convert to lowercase

lolo
1 (str/lower s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/lower "HELLO") // => "hello"

str/padEnd

Pad string from end to target length

lolo
1 (str/padEnd s len char)

Parameters

NameTypeDescription
sstringThe string
lennumberTarget length
charstringPadding character

Returns: string

Example

lolo
1 (str/padEnd "5" 3 "0") // => "500"

str/padStart

Pad string from start to target length

lolo
1 (str/padStart s len char)

Parameters

NameTypeDescription
sstringThe string
lennumberTarget length
charstringPadding character

Returns: string

Example

lolo
1 (str/padStart "5" 3 "0") // => "005"

str/repeat

Repeat string n times

lolo
1 (str/repeat s count)

Parameters

NameTypeDescription
sstringThe string
countnumberRepeat count

Returns: string

Example

lolo
1 (str/repeat "ab" 3) // => "ababab"

str/replace

Replace first occurrence

lolo
1 (str/replace s find replace)

Parameters

NameTypeDescription
sstringThe string
findstringString to find
replacestringReplacement

Returns: string

Example

lolo
1 (str/replace "hello world" "world" "there") // => "hello there"

str/replaceAll

Replace all occurrences

lolo
1 (str/replaceAll s find replace)

Parameters

NameTypeDescription
sstringThe string
findstringString to find
replacestringReplacement

Returns: string

Example

lolo
1 (str/replaceAll "a-b-c" "-" "_") // => "a_b_c"

str/reverse

Reverse string

lolo
1 (str/reverse s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/reverse "hello") // => "olleh"

str/slice

Extract substring

lolo
1 (str/slice s start end)

Parameters

NameTypeDescription
sstringThe string
startnumberStart index
endnumberEnd index (exclusive)

Returns: string

Example

lolo
1 (str/slice "hello" 1 4) // => "ell"

str/snakeCase

Convert to snake_case

lolo
1 (str/snakeCase s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/snakeCase "Hello World") // => "hello_world"

str/split

Split string into array by delimiter

lolo
1 (str/split s delim)

Parameters

NameTypeDescription
sstringThe string
delimstringDelimiter

Returns: array

Example

lolo
1 (str/split "a,b,c" ",") // => ["a", "b", "c"]

str/startsWith

Check if string starts with prefix

lolo
1 (str/startsWith s prefix)

Parameters

NameTypeDescription
sstringThe string
prefixstringPrefix to check

Returns: boolean

Example

lolo
1 (str/startsWith "hello" "hel") // => true

str/template

Variable substitution in template string

lolo
1 (str/template template vars)

Parameters

NameTypeDescription
templatestringTemplate with {placeholders}
varsobjectVariables to substitute

Returns: string

Example

lolo
1 (str/template "Hello, {name}!" {"name":"World"}) // => "Hello, World!"

str/titleCase

Convert to Title Case

lolo
1 (str/titleCase s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/titleCase "hello world") // => "Hello World"

str/trim

Remove leading and trailing whitespace

lolo
1 (str/trim s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/trim " hello ") // => "hello"

str/trimEnd

Remove trailing whitespace

lolo
1 (str/trimEnd s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/trimEnd "hello ") // => "hello"

str/trimStart

Remove leading whitespace

lolo
1 (str/trimStart s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/trimStart " hello") // => "hello"

str/truncate

Truncate string with optional suffix

lolo
1 (str/truncate s len suffix)

Parameters

NameTypeDescription
sstringThe string
lennumberMaximum length
suffixstringSuffix for truncated strings

Returns: string

Example

lolo
1 (str/truncate "Hello World" 8 "...") // => "Hello..."

str/upper

Convert to uppercase

lolo
1 (str/upper s)

Parameters

NameTypeDescription
sstringThe string

Returns: string

Example

lolo
1 (str/upper "hello") // => "HELLO"
Orb

The language where the rule is the program.

© 2026 Almadar. Ljubljana, Slovenia.