العرضar

مولد

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

Callable posture for synchronous stream (generator) functions.

Aliases: generator

Syntax: دالة name(…) مولد → T

Category#

async

Examples#

radix/corpus/fiunt/fiunt.fab (canonical · keyword)#

Callable posture for synchronous stream (generator) functions.

# =============================================================================
# مولد — Synchronous stream callable posture
# =============================================================================
#
# What this teaches:
#   • Preferred stream posture: `مولد → T` yields `T` items.
#   • Yield with statement-initial `سلم value` inside the body.
#
# Common mistakes:
#   • Using `@ cursor` only when teaching preferred morphology — prefer `مولد`.
#
# See also: cursor, سلم, مولد_غيرمتزامن
# =============================================================================

# GRAMMAR:
#   callablePosture :← 'مولد'
#   yieldStmt :← 'سلم' expr
#
# EXPECTED OUTPUT:
#   [1, 2]

دالة stream() مولد → عدد {
    سلم 1
    سلم 2
}

بداية {
    اعرض stream()
}

Expected output:

[1, 2]