scalaria
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
Scalar operations on int, float, and bool in function signatures.
Syntax: fn <name>(<scalar-params>) → <scalar-type> <block>
Category#
type
Related#
Examples#
radix/corpus/scalaria/scalaria.fab (canonical · concept)#
Scalar operations on int, float, and bool in function signatures.
# =============================================================================
# scalaria — Scalar operations on int, float, and bool in function
# signatures.
# =============================================================================
#
# What this teaches:
# • Primitive type operations — demonstrates `int` arithmetic, `float`
# division, `bool` comparison and boolean logic in function signatures
# • Function composition — shows how scalar types compose through parameters
# and return types
#
# Common mistakes:
# • Mixing `int` and `float` without explicit `↦` conversion — primitive families have distinct type widths (SEM008).
#
# See also: int, float, bool
# =============================================================================
# scalaria — scalar operations on primitive types
#
# Demonstrates int, float, and bool parameters with arithmetic,
# comparison, and boolean logic in function signatures.
#
# GRAMMAR:
# funcDecl :← 'fn' ident '(' paramList ')' ('→' type)? block
#
# EXPECTED OUTPUT:
# Compile-only declaration tour (no main).
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
}