← board

NilPy: the remaining missing builtins — min/max, list(), reversed(), enumerate(), hex()

Swept 2026-07-20 against CPython. All of these fail LOUDLY ("undefined variable"), which is why they are one low-priority ticket rather than several: none of them can produce a wrong answer, unlike [[bug-a-nilpy-int-of-string-returns-a-pointer]] found in the same sweep.

builtin uforth sites shape
min / max 7 + 7 DONE c49064af — two-argument only
list(x) 21 DONE 3bc993ef — overloads over a list or a str
reversed(x) 7 DONE 3bc993ef — the reversed COPY, not a lazy iterator
enumerate(x) 4 DONE 3bc993ef — rides the two-name for target
hex(n) 1 DONE 3bc993ef

What already works, for the record

len, abs, ord, chr, isinstance, int of a NUMBER, str of a number, //, %, /, unary minus. ** is absent and has ZERO uforth sites, so it is not worth doing for this corpus.

Shape

min / max / list / hex are plain pylib FUNCTIONS — neither name is a Pascal keyword, so they resolve through the normal call path with no frontend hook, the same way bytearray and bytes do (6468ff22). That makes them a half-hour of work between them.

reversed and enumerate are not: both are iterator protocols in Python, and NilPy's for is a counted-loop desugar with no iterator concept. Either give for a second desugar for each of them (cheap, closed-world) or wait for a real iterator model. enumerate additionally needs tuple unpacking to be worth anything.

Gate

test-nilpy green with a .npy case diffed against CPython + --tier quick

Log