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)
test "intentional ops accept both orders (fn-first and list-first)"
assert_eq(apply([1, 2, 3], (n) => n * 2), [2, 4, 6]) -- list-first also works
assert_eq(where((n) => n > 2, [1, 2, 3, 4]), [3, 4]) -- fn-first also works
assert_eq(reduce((a, b) => a + b, [1, 2, 3], 10), 16) -- extra args stay at the end
test "unique and index_of"
assert_eq(unique([3, 1, 3, 2, 1]), [3, 1, 2]) -- first-appearance order
assert_eq(index_of([10, 20, 30], 20), 1) -- by item
assert_eq(index_of([1, 2, 3], (n) => n > 1), 1) -- by predicate
assert_eq(index_of([1, 2], 9), nothing) -- absent → nothing, not -1
By category
- Collections:
length,contains,slice,keys,values,apply,where,reduce,sort_by,group_by,find_first,every,some,collect,count_where,flatten,chunk,zip_with,unique(dedupe, first-appearance order, structural equality),index_of(0-based index of item or predicate match; absent →nothing, not -1). The intentional ops that take a callable accept both orders —apply(fn, list)andapply(list, fn)read equally well; two tasks or two lists where one-and-one is expected is an explicit error. - 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(encodings:utf8,hex,base64,base64url,base58,base32),sha256,sha512,hmac_sha256,verify_hmac,constant_time_eq. - Web auth (engine v0.5.5+ — see Login & sessions):
password_hash,password_verify,jwt_sign,jwt_verify,totp,totp_verify(pure);random_bytes,token(require random); responseswith_header,set_cookie,clear_cookie;request.cookies; 2-paramauth withtask. - Agent identity & auth (engine v0.5.6+ — see Agent identity): capability tokens
captoken_mint,captoken_attenuate(offline, no key),captoken_verify,captoken_allows(pure); signed requestshttp_sign(require sign("KEY")+ audit) andhttp_signature_verify(pure,opts.algmandatory); third-party OIDCoidc_verify(iss+audmandatory; JWKS needsrequire net(host));mtls_identity(cert, key, opts?)withopts.hostsscoping (require file.read); per-identity metering:spend_total(unit, identity?), identity-scoped rate limits andSYNSEMA_SPEND_CEILING_PER_IDENTITY="agent=UNIT:max"(any unit — no currency is privileged); discovery at/.well-known/synsema-auth. - Time / random:
now,format_time,parse_time,sleep,random,random_int(random,random_bytesandtokenneedrequire random). - JSON:
json_encode,json_decode. - CSV:
csv_parse,csv_encode. - Statistics:
median,percentile,histogram(alsosum,mean,std,var). - Charts:
chart_svg;chart(negotiated content node). - 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. - WebSocket:
ws_connect,ws_send,ws_recv,ws_close, plus multiplexing/resiliencews_select,ws_select_all,ws_broadcast,ws_status,ws_stats(all gated bynet).ws_connectopts:subprotocols,max_queue,max_queue_bytes,on_full,reconnect({max_retries, backoff, backoff_max, on_reconnect}),keepalive({interval, timeout}). - Blockchain (pure):
keccak256,sha512_256,secp256k1_verify/recover/pubkey,ed25519_verify/pubkey,eth_address,rlp_encode/decode,abi_encode/decode/selector,eip191_digest,eip712_digest,solana_message/tx,solana_pda,spl_ata,spl_transfer_data,spl_transfer_checked_data,algorand_tx_encode/tx,algo_address,bytes_to_int,int_to_bytes,int_to_bytes_le. - Blockchain (gated):
secp256k1_sign/ed25519_sign/schnorr_sign(require sign);mnemonic_generate,mnemonic_to_seed,hd_derive,algorand_mnemonic,keystore_import/keystore_export,wif_import(require wallet). - Bitcoin (pure):
hash160,btc_address,btc_address_decode,btc_script,btc_txid,schnorr_verify,schnorr_pubkey,btc_tx,btc_tx_raw,psbt_encode,psbt_decode,psbt_finalize. - Bitcoin (read side, gated by
net):btc_utxos,btc_balance,btc_fee_estimates,btc_send,btc_wait,btc_rpc. - Blockchain read side (gated by
net, like HTTP):eth_rpc,eth_nonce,eth_balance,eth_gas_price,eth_chain_id,eth_estimate_gas,eth_call,eth_fee_history,eth_send_raw,eth_receipt,eth_wait_receipt;solana_rpc,solana_latest_blockhash,solana_balance,solana_send,solana_confirm,spl_balance;algorand_params,algorand_account,algorand_send,algorand_wait. Plus the pure builderstx_eip1559/tx_eip1559_raw. - 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_usage(tokens consumed by this process;0offline — see LLM primitives),llm_step,call,call_tool. - Money / spend ledger (
require spend("UNIT")— see Capabilities):spend(amount, unit, reason)→ the unit's accumulated total (audited inspend.log, host ceilingSYNSEMA_SPEND_CEILING);spend_total(unit)→ the process total, no capability. - Memory / progress / rules (the whole family needs
require memory("name")— see Memory & state):remember,recall,forget_memory,memory_summary,create_progress,start_step,complete_step,fail_step,resume_point,progress_display,progress_percent,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.