العرضar

scalaria

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

Scalar operations on عدد, كسر, and منطقي in function signatures.

Syntax: دالة <name>(<scalar-params>) → <scalar-type> <block>

Category#

type

Examples#

radix/corpus/scalaria/scalaria.fab (canonical · concept)#

Scalar operations on عدد, كسر, and منطقي in function signatures.

# =============================================================================
# scalaria — Scalar operations on عدد, كسر, and منطقي in function
# signatures.
# =============================================================================
#
# What this teaches:
#   • Primitive type operations — demonstrates `عدد` arithmetic, `كسر`
#     division, `منطقي` comparison and boolean logic in function signatures
#   • Function composition — shows how scalar types compose through parameters
#     and return types
#
# Common mistakes:
#   • Mixing `عدد` and `كسر` without explicit `↦` حوّل — primitive families have distinct type widths (SEM008).
#
# See also: عدد, كسر, منطقي
# =============================================================================



# scalaria — scalar operations on primitive types
#
# Demonstrates عدد, كسر, and منطقي parameters with arithmetic,
# comparison, and boolean logic in function signatures.
#
# GRAMMAR:
#   funcDecl :← 'دالة' ident '(' paramList ')' ('→' type)? block
#
# EXPECTED OUTPUT:
#   Compile-only declaration tour (no بداية).

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
}