Builtins index
A categorized map of the built-ins. The full signatures live on each topic page; the core ones are doctested here so this reference can't drift.
-- Doc reference: a few core builtins, doctested so the reference can't drift.
intent: "doc reference: core builtins"
print("upper(\"hi\") = " + upper("hi") + ", join([a,b],\"-\") = " + join(["a", "b"], "-"))
test "collections"
assert_eq(length([1, 2, 3]), 3)
assert(contains([1, 2, 3], 2))
assert_eq(slice([1, 2, 3, 4], 1, 3), [2, 3]) -- Python-style end-exclusive
assert_eq(keys({"a": 1, "b": 2}), ["a", "b"])
assert_eq(values({"a": 1, "b": 2}), [1, 2])
test "text"
assert_eq(upper("hi"), "HI")
assert_eq(trim(" x "), "x")
assert_eq(split("a,b,c", ","), ["a", "b", "c"])
assert_eq(join(["a", "b"], "-"), "a-b")
assert(starts_with("hello", "he"))
test "intentional ops"
assert_eq(apply((n) => n * 2, [1, 2, 3]), [2, 4, 6])
assert_eq(where([1, 2, 3, 4], (n) => n > 2), [3, 4])
assert_eq(reduce([1, 2, 3], (a, b) => a + b, 0), 6)
By category
- Collections:
length,contains,slice,keys,values,apply,where,reduce,sort_by,collect,count_where,flatten,chunk,zip_with. - Text:
upper,lower,fold,trim,starts_with,split,join,replace_text,replace_re,matches,capture,text,fmt. - Numbers / math:
+ - / % *,number, constantspi/tau/e/inf/nan; arraysarray,dot,norm,matmul,solve,det,inv,eig,svd. - Bytes / crypto:
bytes,decode,sha256,sha512,hmac_sha256,verify_hmac,constant_time_eq. - Time / random:
now,format_time,parse_time,sleep,random,random_int(randomneedsrequire random). - JSON:
json_encode,json_decode. - I/O (capability-gated):
read_file,write_file,append_file,edit_file,file_exists,file_info,list_dir,grep,read_file_bytes. - HTTP:
http,http_get,http_post,http_put,http_delete,fetch. - DB:
db_open,sql,sql_exec,sql_batch,sql_tables,paged;mongo_;redis_. - Cron:
cron_every,cron_after,cron_cancel,cron_list,cron_status. - LLM / tools:
llm_available,llm_step,call,call_tool. - Memory / progress / rules:
remember,recall,forget_memory,create_progress,start_step,complete_step,fail_step,resume_point,add_rule,check_rules,get_rules. - Secrets:
secret,as_secret,bearer,reveal. - Responses (serve):
ok,created,fail,not_found,respond,redirect,render,content,paged. - Errors:
raise,assert,assert_eq,assert_ne,assert_error.