Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Core Builtins Reference

All builtins support multilingual names — see Builtin Aliases for the full international lookup table.

Every alias listed in the 5-language tables below is accepted by the interpreter, the lexer/parser, and the lingfu normalize command, so an English program normalized to any of these languages runs unchanged. The interpreter accepts the union of every alias, so you can mix languages in one file.

Output · Core

EN🇨🇳 ZH🇯🇵 JA🇰🇷 KO🇹🇭 THDescription
print / println / 打印印刷출력พิมพ์Print value(s) to stdout
format格式フォーマット서식รูปแบบFormat string with args
ok良し좋아โอเคWrap value as Ok
bad / err悪い나쁨ผิดWrap value as Err
sleep睡眠眠る / スリープ잠자기 / หยุด / นอนSleep for N ms

Math

All math args and results are f64. Angles are in radians.

EN🇨🇳 ZH🇯🇵 JA🇰🇷 KO🇹🇭 THDescription
sin正弦サイン사인ไซน์Sine
cos余弦コサイン코사인โคไซน์Cosine
tan正切タンジェント탄젠트แทนเจนต์Tangent
asin反正弦アークサイン아크사인อาร์กไซน์Arcsine
acos反余弦アークコサイン아크코사인อาร์กโคไซน์Arccosine
atan反正切アークタンジェント아크탄젠트อาร์กแทนเจนต์Arctangent
atan2反正切2アークタンジェント2아크탄젠트2Two-arg arctangent
tanh双曲正切双曲線正接쌍곡탄젠트Hyperbolic tangent
sqrt平方根 / 平方根제곱근รากที่สองSquare root
cbrt立方根立方根세제곱근รากที่สามCube root
powべき乗거듭제곱ยกกำลังx raised to y
exp指数指数関数지수e^x
hypot斜边斜辺빗변√(x²+y²)
ln / log对数対数로그ลอการิทึมNatural log
log2 / log10对数2 / 对数10対数2 / 対数10로그2 / 로그10Base-2 / base-10 log
abs绝对值 / 绝对絶対値절댓값 / 절대값ค่าสัมบูรณ์Absolute value
floor向下取整 / 下整床関数내림ปัดลงRound down
ceil向上取整 / 上整天井関数올림ปัดขึ้นRound up
round四舍五入 / 四舍四捨五入반올림ปัดเศษRound to nearest
trunc / int取整 / 整数整数化 / 切り捨て정수화 / 정수ตัดทศนิยมTruncate toward zero
fract小数部分小数部소수부Fractional part
min最小最小최솟값ต่ำสุดMinimum of two
max最大最大최댓값สูงสุดMaximum of two
clamp截取範囲制限범위제한จำกัดClamp to [lo, hi]
pi圆周率円周率파이พายπ constant
tau双周率タウ타우ทาวτ constant (2π)

Cells marked have no native alias in that language yet (English still works everywhere). Filling these is tracked in TODO.md.

Lists

EN🇨🇳 ZH🇯🇵 JA🇰🇷 KO🇹🇭 THDescription
list_new新建列表新規リスト새목록รายการใหม่Create empty list
list_push列表添加リスト追加목록추가เพิ่มรายการAppend value, return new list
list_get取元素要素取得요소가져오기รับรายการGet element at index
list_join / join连接連結연결รวมรายการJoin list into a string
len / str_len长度長さ길이ความยาวLength of list or string

Strings

FunctionDescription
str_len(s)Length in characters
str_concat(a, b)Concatenate strings
str_slice(s, start, end)Substring
str_to_num(s)Parse as number
num_to_str(n)Number to string
str_contains(s, sub)Substring test

Type checks

FunctionReturns
is_num(v)true if number
is_str(v)true if string
is_list(v)true if list
is_bool(v)true if boolean

Window & display

See Window & Camera reference.

Vector geometry

See vtex reference.

Pixel textures

See tex reference.

Audio

See Audio reference.

Cryptography & Physics

ling-crypto (Blake3, SHA-3, AES-GCM-256, XChaCha20, Ed25519, X25519, Shamir, Schnorr, VRF …) and ling-physics (vectors, rigid bodies, forces, hyperbolic geometry) are exposed as Rust crate APIs, not yet as .ling builtins — call them from Rust, or via a host that embeds the interpreter. Coverage is verified by the crate test suites (crates/ling-crypto/tests, crates/ling-physics/tests). Wiring them in as multilingual builtins is tracked in TODO.md.

FFT (native only, no-op on WASM)

FunctionDescription
fft_push(samples)Feed list of f32 samples to analyzer
fft_bands(n)Return n log-spaced magnitude bands (0..1)
fft_beat()true if current frame energy exceeds average
fft_beat_ratio()energy ratio (1.0 = threshold)
fft_rms()RMS level of current window
fft_dominant_freq()Peak frequency in Hz