Case 004

Closures (nested functions)

A nested def captures the enclosing parameter n (lexical closure).

ok: true — verified live via pnpm eml roundtrip: the supported nested-function subset reaches the Python fixpoint.updated 2026-07-19

EML

eml
def adder(n):
    def add(x):
        return x + n
    add(10) => r
    return r

adder(5) => out
out^0

Python (deterministic transpilation)

python
def adder(n):
    def add(x):
        return x + n
    r = add(10)
    return r

out = adder(5)
print(out)

stdout (executed)

text
15

Trace event types

eml:run:starteml:defeml:calleml:defeml:calleml:returneml:assigneml:returneml:assigneml:outputeml:run:done
ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.