diff options
author | polwex <polwex@sortug.com> | 2025-10-06 23:18:59 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-06 23:18:59 +0700 |
commit | 5de3f7a3ad7b0cf63b4a6cbddfc1e26359dea161 (patch) | |
tree | b55b2258123149bed40bd89bbaa58e7da54f3a26 /ocaml/test/explore_kernel_structure.ml | |
parent | fdab65f6dac4ba85ed4749f61970660d1132d453 (diff) |
cleaned up tests
Diffstat (limited to 'ocaml/test/explore_kernel_structure.ml')
-rw-r--r-- | ocaml/test/explore_kernel_structure.ml | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/ocaml/test/explore_kernel_structure.ml b/ocaml/test/explore_kernel_structure.ml deleted file mode 100644 index 513d47f..0000000 --- a/ocaml/test/explore_kernel_structure.ml +++ /dev/null @@ -1,108 +0,0 @@ -(* Explore the structure of Event 1 kernel *) - -open Nock_lib - -let check_slot noun slot = - try - let _val = Noun.slot (Z.of_int slot) noun in - "✓" - with _ -> "✗" - -let rec to_list acc noun = - match noun with - | Noun.Atom _ -> List.rev acc - | Noun.Cell (item, rest) -> to_list (item :: acc) rest - -let explore _env = - Printf.printf "Exploring Event 1 kernel structure...\n\n"; - - let in_channel = open_in_bin "solid.noun" in - let pill = (Marshal.from_channel in_channel : Noun.noun) in - close_in in_channel; - - match pill with - | Noun.Cell (_tag, events) -> - let event_list = to_list [] events in - - begin match List.nth_opt event_list 1 with - | Some kernel -> - Printf.printf "Event 1 (kernel) slot map:\n"; - Printf.printf " Slot 2 (head): %s\n" (check_slot kernel 2); - Printf.printf " Slot 3 (tail): %s\n" (check_slot kernel 3); - Printf.printf " Slot 4: %s\n" (check_slot kernel 4); - Printf.printf " Slot 5: %s\n" (check_slot kernel 5); - Printf.printf " Slot 6: %s\n" (check_slot kernel 6); - Printf.printf " Slot 7: %s\n" (check_slot kernel 7); - Printf.printf " Slot 20: %s\n" (check_slot kernel 20); - Printf.printf " Slot 23: %s\n" (check_slot kernel 23); - Printf.printf " Slot 42: %s\n" (check_slot kernel 42); - Printf.printf " Slot 87: %s\n" (check_slot kernel 87); - Printf.printf "\n"; - - (* Check if slots 23 and 42 are gates or formulas *) - Printf.printf "Checking slot 23:\n"; - begin try - let slot_23 = Noun.slot (Z.of_int 23) kernel in - match slot_23 with - | Noun.Atom a -> - Printf.printf " Atom: %s\n" (Z.to_string a) - | Noun.Cell (h, t) -> - Printf.printf " Cell (likely a formula or gate)\n"; - Printf.printf " Head: %s\n" (match h with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - Printf.printf " Tail: %s\n" (match t with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - - (* Check if it looks like a gate [battery payload] *) - (* Gate structure: [[formula] [sample context]] *) - begin try - let battery = Noun.head slot_23 in - let payload = Noun.tail slot_23 in - let sample = Noun.head payload in - let _context = Noun.tail payload in - Printf.printf " → Looks like a GATE (has battery/payload/sample/context)\n"; - Printf.printf " Battery: %s\n" (match battery with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - Printf.printf " Sample: %s\n" (match sample with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell") - with _ -> - Printf.printf " → Looks like a FORMULA (not gate structure)\n" - end - with _ -> - Printf.printf " ✗ Error accessing slot 23\n" - end; - - Printf.printf "\nChecking slot 42:\n"; - begin try - let slot_42 = Noun.slot (Z.of_int 42) kernel in - match slot_42 with - | Noun.Atom a -> - Printf.printf " Atom: %s\n" (Z.to_string a) - | Noun.Cell (h, t) -> - Printf.printf " Cell\n"; - Printf.printf " Head: %s\n" (match h with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - Printf.printf " Tail: %s\n" (match t with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - - begin try - let battery = Noun.head slot_42 in - let payload = Noun.tail slot_42 in - let sample = Noun.head payload in - let _context = Noun.tail payload in - Printf.printf " → Looks like a GATE\n"; - Printf.printf " Battery: %s\n" (match battery with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell"); - Printf.printf " Sample: %s\n" (match sample with Noun.Atom _ -> "atom" | Noun.Cell _ -> "cell") - with _ -> - Printf.printf " → Looks like a FORMULA\n" - end - with _ -> - Printf.printf " ✗ Error accessing slot 42\n" - end - - | None -> - Printf.printf "No event 1\n" - end - - | Noun.Atom _ -> - Printf.printf "Pill is atom\n" - -let () = - Printf.printf "\n═══════════════════════════════════════════\n"; - Printf.printf " Explore Kernel Structure\n"; - Printf.printf "═══════════════════════════════════════════\n\n"; - Eio_main.run explore |