scalaria
Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.
Scalar operations on số, thập_phân, and logic in function signatures.
Syntax: hàm <name>(<scalar-params>) → <scalar-type> <block>
Category#
type
Related#
Examples#
radix/corpus/scalaria/scalaria.fab (canonical · concept)#
Scalar operations on số, thập_phân, and logic in function signatures.
# =============================================================================
# scalaria — Scalar operations on số, thập_phân, and logic in function
# signatures.
# =============================================================================
#
# What this teaches:
# • Primitive type operations — demonstrates `số` arithmetic, `thập_phân`
# division, `logic` comparison and boolean logic in function signatures
# • Function composition — shows how scalar types compose through parameters
# and return types
#
# Common mistakes:
# • Mixing `số` and `thập_phân` without explicit `↦` chuyển — primitive families have distinct type widths (SEM008).
#
# See also: số, thập_phân, logic
# =============================================================================
# scalaria — scalar operations on primitive types
#
# Demonstrates số, thập_phân, and logic parameters with arithmetic,
# comparison, and boolean logic in function signatures.
#
# GRAMMAR:
# funcDecl :← 'hàm' ident '(' paramList ')' ('→' type)? block
#
# EXPECTED OUTPUT:
# Compile-only declaration tour (no bắt_đầu).
fn numerica(int a, int b) → int {
return (a + b) * 2
}
fn fracta(float a, float b) → float {
return (a + b) / 2.0
}
fn comparata(int a, int b) → bool {
return a ≤ b
}
fn logica(bool a, bool b) → bool {
return not a and b
}