Archived
kill: purge old-paradigm dist/platform binaries from tree
El SDK Release / build-and-release (push) Failing after 13m0s
El SDK Release / build-and-release (push) Failing after 13m0s
The generated C, amalgams, vendored runtime pins, and compiled binaries from the Claude Code era are removed from the worktree. The El sources survive; this tree is now source-only for the first-principles rebuild. Per Principal direction 2026-08-19.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// core.el — the math floor, rewritten in El (first principles).
|
||||
// The constructor, the state space, ordered roles — the same relatives
|
||||
// the substrate was verified with, now expressed in the language itself.
|
||||
|
||||
// term: a structural value is an atom "0"|"1" or a list ["R", a, b]
|
||||
fn atom0() -> [String] { return ["0"] }
|
||||
fn atom1() -> [String] { return ["1"] }
|
||||
fn is_atom(t: [String]) -> Bool { return str_eq(native_list_get(t, 0), "R") == false }
|
||||
fn is_zero(t: [String]) -> Bool { return is_atom(t) && str_eq(native_list_get(t, 0), "0") }
|
||||
fn is_unit(t: [String]) -> Bool { return is_atom(t) && str_eq(native_list_get(t, 0), "1") }
|
||||
|
||||
// constructor — REFUSES impossible terms (distinct operands only)
|
||||
fn R(a: [String], b: [String]) -> [String] {
|
||||
if str_eq(native_list_get(a, 0), "0") && str_eq(native_list_get(b, 0), "0") { return ["ERROR"] }
|
||||
if str_eq(native_list_get(a, 0), "1") && str_eq(native_list_get(b, 0), "1") { return ["ERROR"] }
|
||||
let t: [String] = native_list_empty()
|
||||
let t = native_list_append(t, "R")
|
||||
let t = native_list_append(t, native_list_get(a, 0))
|
||||
let t = native_list_append(t, native_list_get(b, 0))
|
||||
return t
|
||||
}
|
||||
|
||||
// term equality by serialization (canonical string of the structure)
|
||||
fn term_str(t: [String]) -> String {
|
||||
let n: Int = native_list_len(t)
|
||||
if n == 1 { return native_list_get(t, 0) }
|
||||
let out: String = "R("
|
||||
let out = str_concat(out, str_concat(native_list_get(t, 1), ","))
|
||||
let out = str_concat(out, str_concat(native_list_get(t, 2), ")"))
|
||||
return out
|
||||
}
|
||||
fn term_eq(a: [String], b: [String]) -> Bool { return str_eq(term_str(a), term_str(b)) }
|
||||
|
||||
// ordered-role recovery (P-012): defined only on Im(R)
|
||||
fn L(t: [String]) -> [String] {
|
||||
if is_atom(t) { return ["ERROR"] }
|
||||
return [native_list_get(t, 1)]
|
||||
}
|
||||
fn RR(t: [String]) -> [String] {
|
||||
if is_atom(t) { return ["ERROR"] }
|
||||
return [native_list_get(t, 2)]
|
||||
}
|
||||
|
||||
fn main() -> Void {
|
||||
let z: [String] = atom0()
|
||||
let u: [String] = atom1()
|
||||
let r1: [String] = R(z, u)
|
||||
println(term_str(r1))
|
||||
println(term_str(L(r1)))
|
||||
println(term_str(RR(r1)))
|
||||
println(term_eq(L(r1), z))
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// runtime/el/strings.el — the string family, redo in El.
|
||||
// Replaces the C-builtin string family with El definitions.
|
||||
// Redo discipline: these define the semantics; the C stubs behind the
|
||||
// seam become trampolines, then nothing.
|
||||
|
||||
// concat lifting: the El-level join, no C library logic
|
||||
fn el_join(parts: [String], sep: String) -> String {
|
||||
let n: Int = native_list_len(parts)
|
||||
let out: String = ""
|
||||
let i: Int = 0
|
||||
while i < n {
|
||||
let part: String = native_list_get(parts, i)
|
||||
let out = if i == 0 { part } else { str_concat(out, str_concat(sep, part)) }
|
||||
let i = i + 1
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// pascal-free, redone slice engine: charwise, pure El
|
||||
fn el_reverse(s: String) -> String {
|
||||
let n: Int = str_len(s)
|
||||
let out: String = ""
|
||||
let i: Int = n - 1
|
||||
while i >= 0 {
|
||||
let out = str_concat(out, str_slice(s, i, i + 1))
|
||||
let i = i - 1
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// the family's centerpiece: redo of the builtin, expressed over El
|
||||
fn el_ends_with(s: String, suf: String) -> Bool {
|
||||
let n: Int = str_len(s)
|
||||
let m: Int = str_len(suf)
|
||||
if m > n { return false }
|
||||
return str_eq(str_slice(s, n - m, n), suf)
|
||||
}
|
||||
|
||||
// separator-aware split built on the above, pure El
|
||||
fn el_split(s: String, sep: String) -> [String] {
|
||||
let res: [String] = native_list_empty()
|
||||
let n: Int = str_len(s)
|
||||
let m: Int = str_len(sep)
|
||||
let i: Int = 0
|
||||
let start: Int = 0
|
||||
while i <= n - m {
|
||||
if m == 0 {
|
||||
let acc: [String] = native_list_append(res, s)
|
||||
return acc
|
||||
}
|
||||
if str_eq(str_slice(s, i, i + m), sep) {
|
||||
let res = native_list_append(res, str_slice(s, start, i))
|
||||
let start = i + m
|
||||
let i = i + m
|
||||
} else {
|
||||
let i = i + 1
|
||||
}
|
||||
}
|
||||
let res = native_list_append(res, str_slice(s, start, n))
|
||||
return res
|
||||
}
|
||||
|
||||
fn main() -> Void {
|
||||
println(el_join(["a", "b", "c"], "-"))
|
||||
println(el_reverse("hello"))
|
||||
println(el_ends_with("neuron", "ron"))
|
||||
let parts: [String] = el_split("a-b-c-d", "-")
|
||||
println(el_join(parts, ","))
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "el_runtime.h"
|
||||
|
||||
el_val_t el_join(el_val_t parts, el_val_t sep);
|
||||
el_val_t el_reverse(el_val_t s);
|
||||
el_val_t el_ends_with(el_val_t s, el_val_t suf);
|
||||
el_val_t el_split(el_val_t s, el_val_t sep);
|
||||
|
||||
static el_val_t __el_body_el_join(el_val_t parts, el_val_t sep) {
|
||||
el_val_t n = native_list_len(parts);
|
||||
el_val_t out = EL_STR("");
|
||||
el_val_t i = 0;
|
||||
while (i < n) {
|
||||
el_val_t part = native_list_get(parts, i);
|
||||
out = ({ el_val_t _if_result_1 = 0; if ((i == 0)) { _if_result_1 = (part); } else { _if_result_1 = (str_concat(out, str_concat(sep, part))); } _if_result_1; });
|
||||
i = (i + 1);
|
||||
}
|
||||
return out;
|
||||
return 0;
|
||||
}
|
||||
struct __env_el_join { el_val_t parts; el_val_t sep; };
|
||||
static el_val_t __thunk_el_join(void* __v) {
|
||||
struct __env_el_join* __e = (struct __env_el_join*)__v; (void)__e;
|
||||
return __el_body_el_join(__e->parts, __e->sep);
|
||||
}
|
||||
el_val_t el_join(el_val_t parts, el_val_t sep) {
|
||||
{ el_val_t __s = el_seam_run(EL_STR("el_join"), 0, 0); if (__s) return __s; }
|
||||
struct __env_el_join __env = { parts, sep };
|
||||
el_val_t __r = el_seam_wrap(EL_STR("el_join"), __thunk_el_join, &__env);
|
||||
__r = el_seam_run(EL_STR("el_join"), 1, __r);
|
||||
return __r;
|
||||
}
|
||||
|
||||
static el_val_t __el_body_el_reverse(el_val_t s) {
|
||||
el_val_t n = str_len(s);
|
||||
el_val_t out = EL_STR("");
|
||||
el_val_t i = (n - 1);
|
||||
while (i >= 0) {
|
||||
out = str_concat(out, str_slice(s, i, (i + 1)));
|
||||
i = (i - 1);
|
||||
}
|
||||
return out;
|
||||
return 0;
|
||||
}
|
||||
struct __env_el_reverse { el_val_t s; };
|
||||
static el_val_t __thunk_el_reverse(void* __v) {
|
||||
struct __env_el_reverse* __e = (struct __env_el_reverse*)__v; (void)__e;
|
||||
return __el_body_el_reverse(__e->s);
|
||||
}
|
||||
el_val_t el_reverse(el_val_t s) {
|
||||
{ el_val_t __s = el_seam_run(EL_STR("el_reverse"), 0, 0); if (__s) return __s; }
|
||||
struct __env_el_reverse __env = { s };
|
||||
el_val_t __r = el_seam_wrap(EL_STR("el_reverse"), __thunk_el_reverse, &__env);
|
||||
__r = el_seam_run(EL_STR("el_reverse"), 1, __r);
|
||||
return __r;
|
||||
}
|
||||
|
||||
static el_val_t __el_body_el_ends_with(el_val_t s, el_val_t suf) {
|
||||
el_val_t n = str_len(s);
|
||||
el_val_t m = str_len(suf);
|
||||
if (m > n) {
|
||||
return 0;
|
||||
}
|
||||
return str_eq(str_slice(s, (n - m), n), suf);
|
||||
return 0;
|
||||
}
|
||||
struct __env_el_ends_with { el_val_t s; el_val_t suf; };
|
||||
static el_val_t __thunk_el_ends_with(void* __v) {
|
||||
struct __env_el_ends_with* __e = (struct __env_el_ends_with*)__v; (void)__e;
|
||||
return __el_body_el_ends_with(__e->s, __e->suf);
|
||||
}
|
||||
el_val_t el_ends_with(el_val_t s, el_val_t suf) {
|
||||
{ el_val_t __s = el_seam_run(EL_STR("el_ends_with"), 0, 0); if (__s) return __s; }
|
||||
struct __env_el_ends_with __env = { s, suf };
|
||||
el_val_t __r = el_seam_wrap(EL_STR("el_ends_with"), __thunk_el_ends_with, &__env);
|
||||
__r = el_seam_run(EL_STR("el_ends_with"), 1, __r);
|
||||
return __r;
|
||||
}
|
||||
|
||||
static el_val_t __el_body_el_split(el_val_t s, el_val_t sep) {
|
||||
el_val_t res = native_list_empty();
|
||||
el_val_t n = str_len(s);
|
||||
el_val_t m = str_len(sep);
|
||||
el_val_t i = 0;
|
||||
el_val_t start = 0;
|
||||
while (i <= (n - m)) {
|
||||
if (m == 0) {
|
||||
el_val_t acc = native_list_append(res, s);
|
||||
return acc;
|
||||
}
|
||||
if (str_eq(str_slice(s, i, (i + m)), sep)) {
|
||||
res = native_list_append(res, str_slice(s, start, i));
|
||||
start = (i + m);
|
||||
i = (i + m);
|
||||
} else {
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
res = native_list_append(res, str_slice(s, start, n));
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
struct __env_el_split { el_val_t s; el_val_t sep; };
|
||||
static el_val_t __thunk_el_split(void* __v) {
|
||||
struct __env_el_split* __e = (struct __env_el_split*)__v; (void)__e;
|
||||
return __el_body_el_split(__e->s, __e->sep);
|
||||
}
|
||||
el_val_t el_split(el_val_t s, el_val_t sep) {
|
||||
{ el_val_t __s = el_seam_run(EL_STR("el_split"), 0, 0); if (__s) return __s; }
|
||||
struct __env_el_split __env = { s, sep };
|
||||
el_val_t __r = el_seam_wrap(EL_STR("el_split"), __thunk_el_split, &__env);
|
||||
__r = el_seam_run(EL_STR("el_split"), 1, __r);
|
||||
return __r;
|
||||
}
|
||||
|
||||
int main(int _argc, char** _argv) {
|
||||
el_runtime_init_args(_argc, _argv);
|
||||
println(el_join(el_list_new(3, EL_STR("a"), EL_STR("b"), EL_STR("c")), EL_STR("-")));
|
||||
println(el_reverse(EL_STR("hello")));
|
||||
println(el_ends_with(EL_STR("neuron"), EL_STR("ron")));
|
||||
el_val_t parts = el_split(EL_STR("a-b-c-d"), EL_STR("-"));
|
||||
println(el_join(parts, EL_STR(",")));
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user