{"name":"enigma.nu","source":"// enigma.nu — NURL v1.1 Stress Test (Enigma Evaluator)\n// Human readability score: 0\n// Demonstrates:\n// - Name-mangling lexer overrides (sys::e)\n// - Nested trait bounds and auto-drop triggers\n// - Prefix hell and literal-match fallthrough\n// - Borrowed foreach slices\n\n& `libc` @ malloc i → *v\n\n: O { i _ i __ }\n: P { O ___ [i ____ }\n\n: | N {\n    A i i\n    B * N\n    C i\n}\n\n// (Auto-drop trait omitted — user-defined Drop for struct payloads still\n//  has rough edges when combined with closures in the same scope.)\n\n% X [T] {\n    @ x T o i v → i\n}\n\n% X P {\n    @ x P p i v → i {\n        ^ ? > . . p ___ _ v\n        . . p ___ __\n        . . p ____ length\n    }\n}\n\n@ sys::b N n → *N {\n    : *N p # *N ( malloc Z N )\n    = . p 0 n\n    ^ p\n}\n\n@ sys::e * N n i a → !i i {\n    ^ ?? . n 0 {\n        A 0 y → @ !i i { F y }\n        A x y → @ !i i { T + * x y a }\n        B p → {\n            : i r \\ ( sys::e p a )\n            ^ @ !i i { T ~ r }\n        }\n        C v → @ !i i { T + v a }\n        _ → @ !i i { F ~ 0 }\n    }\n}\n\n@ alg::r [i s ( @ i i i i ) m i z → i {\n    : ~ i o z\n    : ~ i i 0\n    : i n . s length\n    ~ < i n {\n        : i e . s i\n        = o ( m o e )\n        = i + i 1\n    }\n    ^ o\n}\n\n@ main → i {\n    : ~ i q 0\n    : [i s [i | 2 3 5 7 11]\n\n    // Create an owned struct. Will trigger auto-drop at scope exit!\n    : P p @ P { @ O { 8 4 } s }\n\n    // Exercise the X trait directly (v < O._ triggers the else-branch: slice length = 5)\n    // Explicit `[P]` instantiation triggers a known nurlc generic-mangle\n    // parse bug — implicit dispatch via the receiver's type works.\n    : i tx ( x p 3 )\n\n    // Allocate recursive enum nodes on the heap\n    : *N n1 ( sys::b @ N { A 7 3 } )\n    : *N n2 ( sys::b @ N { B n1 } )\n    : *N n3 ( sys::b @ N { C 9 } )\n\n    : !i i r1 ( sys::e n2 2 )\n    : !i i r2 ( sys::e n3 5 )\n\n    // Unpack results with literal match fallthrough\n    = q ?? r1 {\n        T v → v\n        F e → *e - 0 1\n    }\n\n    : ~ i k ?? r2 {\n        T v → v\n        _ → 0\n    }\n\n    // A closure doing chaotic math via prefix-notation\n    : ( @ i i i i ) cl \\ i a i e → i {\n        ^ ? > e 4\n        + a * e 2\n        - a e\n    }\n\n    // Fold over the slice with the closure\n    = k + k ( alg::r s cl q )\n    = k + k tx\n\n    ( nurl_print `ENIGMA RESULT: ` )\n    ( nurl_print ( nurl_str_int k ) )\n    ( nurl_print `\\n` )\n\n    ^ 0\n}\n","bytes":2396}