(* Check the actual lifecycle formula structure *) open Nock_lib let () = let formula = Noun.cell (Noun.atom 2) (Noun.cell (Noun.cell (Noun.atom 0) (Noun.atom 3)) (Noun.cell (Noun.atom 0) (Noun.atom 2))) in Printf.printf "Lifecycle formula: [2 [0 3] [0 2]]\n"; Printf.printf "Formula is cell: %b\n" (Noun.is_cell formula); let h = Noun.head formula in let t = Noun.tail formula in Printf.printf "Head (opcode): "; (match h with | Noun.Atom { z; _ } -> Printf.printf "atom %s\n" (Z.to_string z) | Noun.Cell _ -> Printf.printf "cell\n"); Printf.printf "Tail (gal): cell\n"; let b_gal = Noun.head t in (* [0 3] *) let c_gal = Noun.tail t in (* [0 2] *) Printf.printf "b_gal ([0 3]): "; (match b_gal with | Noun.Atom _ -> Printf.printf "atom\n" | Noun.Cell { h; t; _ } -> Printf.printf "cell ["; (match h with Noun.Atom { z; _ } -> Printf.printf "%s " (Z.to_string z) | _ -> ()); (match t with Noun.Atom { z; _ } -> Printf.printf "%s" (Z.to_string z) | _ -> ()); Printf.printf "]\n"); Printf.printf "c_gal ([0 2]): "; (match c_gal with | Noun.Atom _ -> Printf.printf "atom\n" | Noun.Cell { h; t; _ } -> Printf.printf "cell ["; (match h with Noun.Atom { z; _ } -> Printf.printf "%s " (Z.to_string z) | _ -> ()); (match t with Noun.Atom { z; _ } -> Printf.printf "%s" (Z.to_string z) | _ -> ()); Printf.printf "]\n")