@@ -2,14 +2,15 @@ use core::panic;
2use murmur3::murmur3_32;
2use murmur3::murmur3_32;
3use num_integer::Integer;
3use num_integer::Integer;
5 collections::BTreeMap,
6 collections::BTreeMap,
6 iter::{once, repeat_n, zip},
7 iter::{once, repeat_n, zip},
10use crate::{
11use crate::{
11− interpreter::{slam_pulled_gate, InterpreterContext, Tanks},
12+ interpreter::{slam_pulled_gate, InterpreterContext, TTanks, EMPTY_TANKS},
12− noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
13+ noun::{self, cell, AsNoun, Atom, Edge, Hair, Nail, Noun},
15fn traverse_iter_result<E: Clone, T: Clone, I: Iterator<Item = Result<T, E>>>(
16fn traverse_iter_result<E: Clone, T: Clone, I: Iterator<Item = Result<T, E>>>(
@@ -107,18 +108,23 @@ pub fn generate_jets() -> Jets {
107 (124976064672625230427889101290245200507, TRIP),
108 (124976064672625230427889101290245200507, TRIP),
108 (4078279288073906183633157465551067635, MUK),
109 (4078279288073906183633157465551067635, MUK),
109 (261900159748071234702685239353558471892, MUG),
110 (261900159748071234702685239353558471892, MUG),
111+ (198191257620924788695943358402651905954, AOR),
112+ (299422828284010240628877806738195667652, DOR),
113+ (166326796552601297695313176538120818632, GOR),
114+ (7942398240152905363972500667649380756, MOR),
115+ (315687984998079865981003916817293521765, LOOK),
113−pub type Jet = fn(ctx: &mut InterpreterContext, &Rc<Noun>) -> Result<Rc<Noun>, Tanks>;
119+pub type Jet = fn(ctx: &mut InterpreterContext, &Rc<Noun>) -> Result<Rc<Noun>, TTanks>;
114pub type DoubleJet = fn(ctx: &mut InterpreterContext, &Rc<Noun>, &Rc<Noun>) -> Option<Rc<Noun>>;
120pub type DoubleJet = fn(ctx: &mut InterpreterContext, &Rc<Noun>, &Rc<Noun>) -> Option<Rc<Noun>>;
116−static BINARY_ATOM: fn(&Rc<Noun>, fn(&Atom, &Atom) -> Atom) -> Result<Rc<Noun>, Tanks> =
122+static BINARY_ATOM: fn(&Rc<Noun>, fn(&Atom, &Atom) -> Atom) -> Result<Rc<Noun>, TTanks> =
117 |n: &Rc<Noun>, f: fn(&Atom, &Atom) -> Atom| {
123 |n: &Rc<Noun>, f: fn(&Atom, &Atom) -> Atom| {
118− let (p, q) = n.as_cell().ok_or(Tanks::new())?;
124+ let (p, q) = n.as_cell().ok_or(TTanks::new())?;
119 Ok(Rc::new(Noun::Atom(f(
125 Ok(Rc::new(Noun::Atom(f(
120− p.as_atom().ok_or(Tanks::new())?,
126+ p.as_atom().ok_or(TTanks::new())?,
121− q.as_atom().ok_or(Tanks::new())?,
127+ q.as_atom().ok_or(TTanks::new())?,
@@ -126,13 +132,13 @@ static BINARY_ATOM_LOOB: fn(
126 &InterpreterContext,
132 &InterpreterContext,
127 &Rc<Noun>,
133 &Rc<Noun>,
128 fn(&Atom, &Atom) -> bool,
134 fn(&Atom, &Atom) -> bool,
129−) -> Result<Rc<Noun>, Tanks> =
135+) -> Result<Rc<Noun>, TTanks> =
130 |ctx: &InterpreterContext, n: &Rc<Noun>, f: fn(&Atom, &Atom) -> bool| {
136 |ctx: &InterpreterContext, n: &Rc<Noun>, f: fn(&Atom, &Atom) -> bool| {
131− let (p, q) = n.as_cell().ok_or(Tanks::new())?;
137+ let (p, q) = n.as_cell().ok_or(TTanks::new())?;
134− p.as_atom().ok_or(Tanks::new())?,
140+ p.as_atom().ok_or(TTanks::new())?,
135− q.as_atom().ok_or(Tanks::new())?,
141+ q.as_atom().ok_or(TTanks::new())?,
137 Ok(ctx.nouns.sig.clone())
143 Ok(ctx.nouns.sig.clone())
@@ -143,18 +149,22 @@ static BINARY_ATOM_LOOB: fn(
143static BINARY_ATOM_PAIR: fn(
149static BINARY_ATOM_PAIR: fn(
144 &Rc<Noun>,
150 &Rc<Noun>,
145 fn(&Atom, &Atom) -> (Atom, Atom),
151 fn(&Atom, &Atom) -> (Atom, Atom),
146−) -> Result<Rc<Noun>, Tanks> = |n: &Rc<Noun>, f: fn(&Atom, &Atom) -> (Atom, Atom)| {
152+) -> Result<Rc<Noun>, TTanks> = |n: &Rc<Noun>, f: fn(&Atom, &Atom) -> (Atom, Atom)| {
147− let (p, q) = n.as_cell().ok_or(Tanks::new())?;
153+ let (p, q) = n.as_cell().ok_or(TTanks::new())?;
149 let (a, b) = f(
155 let (a, b) = f(
150− p.as_atom().ok_or(Tanks::new())?,
156+ p.as_atom().ok_or(TTanks::new())?,
151− q.as_atom().ok_or(Tanks::new())?,
157+ q.as_atom().ok_or(TTanks::new())?,
153 Ok(cell(&Rc::new(Noun::Atom(a)), &Rc::new(Noun::Atom(b))))
159 Ok(cell(&Rc::new(Noun::Atom(a)), &Rc::new(Noun::Atom(b))))
156static ADD: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a + b);
162static ADD: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a + b);
163+static DEC: Jet = |_ctx, n| {
164+ Ok(Rc::new(Noun::Atom(
157−static DEC: Jet = |_ctx, n| Ok(Rc::new(Noun::Atom(n.as_atom().ok_or(Tanks::new())? - 1u32)));
165+ n.as_atom().ok_or(TTanks::new())? - 1u32,
158static DVR: Jet = |_ctx, n| BINARY_ATOM_PAIR(n, |a, b| a.div_rem(&b));
168static DVR: Jet = |_ctx, n| BINARY_ATOM_PAIR(n, |a, b| a.div_rem(&b));
159static DIV: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a / b);
169static DIV: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a / b);
160static GTE: Jet = |ctx, n| BINARY_ATOM_LOOB(ctx, n, |a, b| a >= b);
170static GTE: Jet = |ctx, n| BINARY_ATOM_LOOB(ctx, n, |a, b| a >= b);
@@ -168,30 +178,30 @@ static MUL: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a * b);
168static SUB: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a - b);
178static SUB: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a - b);
170static CAP: Jet = |ctx, n| {
180static CAP: Jet = |ctx, n| {
171− let n = n.as_atom().ok_or(Tanks::new())?;
181+ let n = n.as_atom().ok_or(TTanks::new())?;
172 CAP_ATOM(ctx, n.clone())
182 CAP_ATOM(ctx, n.clone())
175−static CAP_ATOM: fn(&InterpreterContext, Atom) -> Result<Rc<Noun>, Tanks> = |ctx, n: Atom| {
185+static CAP_ATOM: fn(&InterpreterContext, Atom) -> Result<Rc<Noun>, TTanks> = |ctx, n: Atom| {
176 let mut n_iter = n.iter_u32_digits();
186 let mut n_iter = n.iter_u32_digits();
178 match n_iter.len() {
188 match n_iter.len() {
179− 0 => Err(Tanks::new()),
189+ 0 => Err(TTanks::new()),
180 1 => CAP_U32(ctx, n_iter.next().unwrap()),
190 1 => CAP_U32(ctx, n_iter.next().unwrap()),
181 _ => CAP_ATOM(ctx, n >> 1),
191 _ => CAP_ATOM(ctx, n >> 1),
184−static CAP_U32: fn(ctx: &InterpreterContext, u32) -> Result<Rc<Noun>, Tanks> = |ctx, n| match n {
194+static CAP_U32: fn(ctx: &InterpreterContext, u32) -> Result<Rc<Noun>, TTanks> = |ctx, n| match n {
185− 0 | 1 => Err(Tanks::new()),
195+ 0 | 1 => Err(TTanks::new()),
186 2 => Ok(ctx.nouns.two.clone()),
196 2 => Ok(ctx.nouns.two.clone()),
187 3 => Ok(ctx.nouns.three.clone()),
197 3 => Ok(ctx.nouns.three.clone()),
188 n => CAP_U32(ctx, n >> 1),
198 n => CAP_U32(ctx, n >> 1),
191static MAS: Jet = |ctx, n| {
201static MAS: Jet = |ctx, n| {
192− let n = n.as_atom().ok_or(Tanks::new())?;
202+ let n = n.as_atom().ok_or(TTanks::new())?;
193 Ok(Rc::new(Noun::Atom(
203 Ok(Rc::new(Noun::Atom(
194− MAS_ATOM(ctx, n.clone()).ok_or(Tanks::new())?,
204+ MAS_ATOM(ctx, n.clone()).ok_or(TTanks::new())?,
197static MAS_ATOM: fn(&InterpreterContext, Atom) -> Option<Atom> = |ctx, n| {
207static MAS_ATOM: fn(&InterpreterContext, Atom) -> Option<Atom> = |ctx, n| {
@@ -213,22 +223,22 @@ static MAS_U32: fn(u32) -> u32 = |n| match n {
215static PEG: Jet = |ctx, n| {
225static PEG: Jet = |ctx, n| {
216− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
226+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
218− let a = a.as_atom().ok_or(Tanks::new())?;
228+ let a = a.as_atom().ok_or(TTanks::new())?;
219− let b = b.as_atom().ok_or(Tanks::new())?;
229+ let b = b.as_atom().ok_or(TTanks::new())?;
221 if *a == Atom::ZERO {
231 if *a == Atom::ZERO {
222− return Err(Tanks::new());
232+ return Err(TTanks::new());
225 Ok(Rc::new(Noun::Atom(PEG_ATOM(ctx, a, b.clone())?)))
235 Ok(Rc::new(Noun::Atom(PEG_ATOM(ctx, a, b.clone())?)))
227−static PEG_ATOM: fn(&InterpreterContext, &Atom, Atom) -> Result<Atom, Tanks> = |ctx, a, b| {
237+static PEG_ATOM: fn(&InterpreterContext, &Atom, Atom) -> Result<Atom, TTanks> = |ctx, a, b| {
228 let mut b_iter = b.iter_u32_digits();
238 let mut b_iter = b.iter_u32_digits();
230 match b_iter.len() {
240 match b_iter.len() {
231− 0 => Err(Tanks::new()),
241+ 0 => Err(TTanks::new()),
232 1 => Ok(PEG_U32(a, b_iter.next().unwrap())),
242 1 => Ok(PEG_U32(a, b_iter.next().unwrap())),
233 _ => Ok((&b & &ctx.big_uints.one) + (PEG_ATOM(ctx, a, b >> 1)? << 1)),
243 _ => Ok((&b & &ctx.big_uints.one) + (PEG_ATOM(ctx, a, b >> 1)? << 1)),
@@ -242,7 +252,7 @@ static PEG_U32: fn(&Atom, u32) -> Atom = |a, b| match b {
244static FAND: Jet = |ctx, n| {
254static FAND: Jet = |ctx, n| {
245− let (nedl, hstk) = n.as_cell().ok_or(Tanks::new())?;
255+ let (nedl, hstk) = n.as_cell().ok_or(TTanks::new())?;
246 if nedl.is_sig() || hstk.is_sig() {
256 if nedl.is_sig() || hstk.is_sig() {
247 return Ok(ctx.nouns.sig.clone());
257 return Ok(ctx.nouns.sig.clone());
@@ -272,7 +282,7 @@ static FAND: Jet = |ctx, n| {
274static FIND: Jet = |ctx, n| {
284static FIND: Jet = |ctx, n| {
275− let (nedl, hstk) = n.as_cell().ok_or(Tanks::new())?;
285+ let (nedl, hstk) = n.as_cell().ok_or(TTanks::new())?;
276 if nedl.is_sig() || hstk.is_sig() {
286 if nedl.is_sig() || hstk.is_sig() {
277 return Ok(ctx.nouns.sig.clone());
287 return Ok(ctx.nouns.sig.clone());
@@ -305,13 +315,13 @@ static FLOP: Jet = |ctx, n| {
307static GULF: Jet = |_ctx, n| {
317static GULF: Jet = |_ctx, n| {
308− let (from, to) = n.as_cell().ok_or(Tanks::new())?;
318+ let (from, to) = n.as_cell().ok_or(TTanks::new())?;
310− let mut from = (*from.as_atom().ok_or(Tanks::new())?).clone();
320+ let mut from = (*from.as_atom().ok_or(TTanks::new())?).clone();
311− let to = to.as_atom().ok_or(Tanks::new())?.clone();
321+ let to = to.as_atom().ok_or(TTanks::new())?.clone();
313 if from > to {
323 if from > to {
314− return Err(Tanks::new());
324+ return Err(TTanks::new());
317 let mut tmp = Vec::new();
327 let mut tmp = Vec::new();
@@ -325,10 +335,10 @@ static GULF: Jet = |_ctx, n| {
327static INTO: Jet = |_ctx, n| {
337static INTO: Jet = |_ctx, n| {
328− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
338+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
329− let (b, c) = b.as_cell().ok_or(Tanks::new())?;
339+ let (b, c) = b.as_cell().ok_or(TTanks::new())?;
331− let mut b_iter = b.as_atom().ok_or(Tanks::new())?.iter_u32_digits();
341+ let mut b_iter = b.as_atom().ok_or(TTanks::new())?.iter_u32_digits();
333 match b_iter.len() {
343 match b_iter.len() {
334 0 => Ok(cell(&c, &a)),
344 0 => Ok(cell(&c, &a)),
@@ -358,7 +368,7 @@ static INTO: Jet = |_ctx, n| {
360static JOIN: Jet = |_ctx, n| {
370static JOIN: Jet = |_ctx, n| {
361− let (sep, list) = n.as_cell().ok_or(Tanks::new())?;
371+ let (sep, list) = n.as_cell().ok_or(TTanks::new())?;
362 Ok(Noun::list_refs(
372 Ok(Noun::list_refs(
363 list.list_iter()
373 list.list_iter()
364 .intersperse(sep)
374 .intersperse(sep)
@@ -376,7 +386,7 @@ static LENT: Jet = |_ctx, n| {
378static LEVY: Jet = |ctx, n| {
388static LEVY: Jet = |ctx, n| {
379− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
389+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
380 if traverse_iter_result(a.list_iter().map(|n| slam_pulled_gate(ctx, b, n)))?
390 if traverse_iter_result(a.list_iter().map(|n| slam_pulled_gate(ctx, b, n)))?
382 .all(|x| x.is_y())
392 .all(|x| x.is_y())
@@ -388,7 +398,7 @@ static LEVY: Jet = |ctx, n| {
390static LIEN: Jet = |ctx, n| {
400static LIEN: Jet = |ctx, n| {
391− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
401+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
392 if traverse_iter_result(a.list_iter().map(|n| slam_pulled_gate(ctx, b, n)))?
402 if traverse_iter_result(a.list_iter().map(|n| slam_pulled_gate(ctx, b, n)))?
394 .any(|x| x.is_y())
404 .any(|x| x.is_y())
@@ -400,7 +410,7 @@ static LIEN: Jet = |ctx, n| {
402static MURN: Jet = |ctx, n| {
412static MURN: Jet = |ctx, n| {
403− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
413+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
405 Ok(Noun::list_refs(
415 Ok(Noun::list_refs(
406 traverse_iter_result(
416 traverse_iter_result(
@@ -413,7 +423,7 @@ static MURN: Jet = |ctx, n| {
415static REAP: Jet = |_ctx, n| {
425static REAP: Jet = |_ctx, n| {
416− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
426+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
418 Ok(Noun::list_refs(repeat_n(
428 Ok(Noun::list_refs(repeat_n(
419 b.clone(),
429 b.clone(),
@@ -421,17 +431,17 @@ static REAP: Jet = |_ctx, n| {
424−static REAR: Jet = |_ctx, n| n.list_iter().last().ok_or(Tanks::new()).cloned();
434+static REAR: Jet = |_ctx, n| n.list_iter().last().ok_or(TTanks::new()).cloned();
426static REEL: Jet = |ctx, n| {
436static REEL: Jet = |ctx, n| {
427− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
437+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
429 list.list_iter().collect::<Vec<_>>().iter().rfold(
439 list.list_iter().collect::<Vec<_>>().iter().rfold(
431 .gate_sample()
441 .gate_sample()
432− .ok_or(Tanks::new())?
442+ .ok_or(TTanks::new())?
433 .as_cell()
443 .as_cell()
434− .ok_or(Tanks::new())?
444+ .ok_or(TTanks::new())?
436 .clone()),
446 .clone()),
437 |acc, next| {
447 |acc, next| {
@@ -442,15 +452,15 @@ static REEL: Jet = |ctx, n| {
444static ROLL: Jet = |ctx, n| {
454static ROLL: Jet = |ctx, n| {
445− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
455+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
447 list.list_iter().fold(
457 list.list_iter().fold(
450 .gate_sample()
460 .gate_sample()
451− .ok_or(Tanks::new())?
461+ .ok_or(TTanks::new())?
452 .as_cell()
462 .as_cell()
453− .ok_or(Tanks::new())?
463+ .ok_or(TTanks::new())?
455 .clone()),
465 .clone()),
456 |acc, next| {
466 |acc, next| {
@@ -461,7 +471,7 @@ static ROLL: Jet = |ctx, n| {
463static SCAG: Jet = |_ctx, n| {
473static SCAG: Jet = |_ctx, n| {
464− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
474+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
466 Ok(Noun::list_refs(
476 Ok(Noun::list_refs(
467 b.list_iter()
477 b.list_iter()
@@ -474,7 +484,7 @@ static SCAG: Jet = |_ctx, n| {
476static SKID: Jet = |ctx, n| {
486static SKID: Jet = |ctx, n| {
477− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
487+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
479 let slammed_n = traverse_iter_result(
489 let slammed_n = traverse_iter_result(
480 list.list_iter()
490 list.list_iter()
@@ -489,7 +499,7 @@ static SKID: Jet = |ctx, n| {
491static SKIM: Jet = |ctx, n| {
501static SKIM: Jet = |ctx, n| {
492− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
502+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
494 Ok(Noun::list_refs(
504 Ok(Noun::list_refs(
495 traverse_iter_result(
505 traverse_iter_result(
@@ -503,7 +513,7 @@ static SKIM: Jet = |ctx, n| {
505static SKIP: Jet = |ctx, n| {
515static SKIP: Jet = |ctx, n| {
506− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
516+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
508 Ok(Noun::list_refs(
518 Ok(Noun::list_refs(
509 traverse_iter_result(
519 traverse_iter_result(
@@ -517,9 +527,9 @@ static SKIP: Jet = |ctx, n| {
519static SLAG: Jet = |ctx, n| {
529static SLAG: Jet = |ctx, n| {
520− let (a, list) = n.as_cell().ok_or(Tanks::new())?;
530+ let (a, list) = n.as_cell().ok_or(TTanks::new())?;
522− let mut a_iter = a.as_atom().ok_or(Tanks::new())?.iter_u32_digits();
532+ let mut a_iter = a.as_atom().ok_or(TTanks::new())?.iter_u32_digits();
524 match a_iter.len() {
534 match a_iter.len() {
525 0 => Ok(list.clone()),
535 0 => Ok(list.clone()),
@@ -536,12 +546,12 @@ static SLAG: Jet = |ctx, n| {
538static SNAG: Jet = |_ctx, n| {
548static SNAG: Jet = |_ctx, n| {
539− let (a, list) = n.as_cell().ok_or(Tanks::new())?;
549+ let (a, list) = n.as_cell().ok_or(TTanks::new())?;
541 list.list_iter()
551 list.list_iter()
542 .nth(a.as_u32().unwrap() as usize)
552 .nth(a.as_u32().unwrap() as usize)
543 .cloned()
553 .cloned()
544− .ok_or(Tanks::new())
554+ .ok_or(TTanks::new())
547static SNIP: Jet = |_ctx, n| {
557static SNIP: Jet = |_ctx, n| {
@@ -558,7 +568,7 @@ static SNIP: Jet = |_ctx, n| {
560static SNOC: Jet = |_ctx, n| {
570static SNOC: Jet = |_ctx, n| {
561− let (list, b) = n.as_cell().ok_or(Tanks::new())?;
571+ let (list, b) = n.as_cell().ok_or(TTanks::new())?;
563 Ok(Noun::list_refs(
573 Ok(Noun::list_refs(
564 list.list_iter()
574 list.list_iter()
@@ -589,15 +599,15 @@ static SNOC: Jet = |_ctx, n| {
591static SPIN: Jet = |ctx, n| {
601static SPIN: Jet = |ctx, n| {
592− let (list, b) = n.as_cell().ok_or(Tanks::new())?;
602+ let (list, b) = n.as_cell().ok_or(TTanks::new())?;
593− let (acc, gate) = b.as_cell().ok_or(Tanks::new())?;
603+ let (acc, gate) = b.as_cell().ok_or(TTanks::new())?;
595 let mut res = Vec::new();
605 let mut res = Vec::new();
596 let mut acc = acc.clone();
606 let mut acc = acc.clone();
598 for n in list.list_iter() {
608 for n in list.list_iter() {
599 let foo = slam_pulled_gate(ctx, gate, &cell(&n, &acc))?;
609 let foo = slam_pulled_gate(ctx, gate, &cell(&n, &acc))?;
600− let (el, new_acc) = foo.as_cell().ok_or(Tanks::new())?;
610+ let (el, new_acc) = foo.as_cell().ok_or(TTanks::new())?;
601 acc = new_acc.clone();
611 acc = new_acc.clone();
602 res.push(el.clone());
612 res.push(el.clone());
@@ -606,20 +616,20 @@ static SPIN: Jet = |ctx, n| {
608static SPUN: Jet = |ctx, n| {
618static SPUN: Jet = |ctx, n| {
609− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
619+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
611 let mut res = Vec::new();
621 let mut res = Vec::new();
612 let mut acc = gate
622 let mut acc = gate
613 .gate_sample()
623 .gate_sample()
614− .ok_or(Tanks::new())?
624+ .ok_or(TTanks::new())?
615 .as_cell()
625 .as_cell()
616− .ok_or(Tanks::new())?
626+ .ok_or(TTanks::new())?
618 .clone();
628 .clone();
620 for n in list.list_iter() {
630 for n in list.list_iter() {
621 let foo = slam_pulled_gate(ctx, gate, &cell(&n, &acc))?;
631 let foo = slam_pulled_gate(ctx, gate, &cell(&n, &acc))?;
622− let (el, new_acc) = foo.as_cell().ok_or(Tanks::new())?;
632+ let (el, new_acc) = foo.as_cell().ok_or(TTanks::new())?;
623 acc = new_acc.clone();
633 acc = new_acc.clone();
624 res.push(el.clone());
634 res.push(el.clone());
@@ -628,7 +638,7 @@ static SPUN: Jet = |ctx, n| {
630static TURN: Jet = |ctx, n| {
640static TURN: Jet = |ctx, n| {
631− let (list, gate) = n.as_cell().ok_or(Tanks::new())?;
641+ let (list, gate) = n.as_cell().ok_or(TTanks::new())?;
632 Ok(Noun::list_refs(
642 Ok(Noun::list_refs(
633 traverse_iter_result(list.list_iter().map(|x| slam_pulled_gate(ctx, gate, x)))?
643 traverse_iter_result(list.list_iter().map(|x| slam_pulled_gate(ctx, gate, x)))?
@@ -637,7 +647,7 @@ static TURN: Jet = |ctx, n| {
639static WELD: Jet = |_ctx, n| {
649static WELD: Jet = |_ctx, n| {
640− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
650+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
642 Ok(Noun::list_refs(
652 Ok(Noun::list_refs(
643 a.list_iter()
653 a.list_iter()
@@ -670,18 +680,20 @@ static BEX: Jet = |ctx, n| {
672static END: Jet = |ctx, n| {
682static END: Jet = |ctx, n| {
673− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
683+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
674 let bite = a.as_bite();
684 let bite = a.as_bite();
676 let bits = bite.bits();
686 let bits = bite.bits();
678 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
688 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
690+ Ok(Rc::new(Noun::Atom(
680− Ok(Rc::new(Noun::Atom(mask & b.as_atom().ok_or(Tanks::new())?)))
691+ mask & b.as_atom().ok_or(TTanks::new())?,
683static CAN: Jet = |ctx, n| {
695static CAN: Jet = |ctx, n| {
684− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
696+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
685 let bloq = a.as_u32().unwrap();
697 let bloq = a.as_u32().unwrap();
686 let bloq_ = 2u32.pow(bloq);
698 let bloq_ = 2u32.pow(bloq);
@@ -696,16 +708,16 @@ static CAN: Jet = |ctx, n| {
696 Some((acc? << bits) | (mask & q.as_atom()?))
708 Some((acc? << bits) | (mask & q.as_atom()?))
699− Ok(Rc::new(Noun::Atom(atom.ok_or(Tanks::new())?)))
711+ Ok(Rc::new(Noun::Atom(atom.ok_or(TTanks::new())?)))
702static CAT: Jet = |_ctx, n| {
714static CAT: Jet = |_ctx, n| {
703− let (bloq, b) = n.as_cell().ok_or(Tanks::new())?;
715+ let (bloq, b) = n.as_cell().ok_or(TTanks::new())?;
704− let (b, c) = b.as_cell().ok_or(Tanks::new())?;
716+ let (b, c) = b.as_cell().ok_or(TTanks::new())?;
706− let bloq = bloq.as_u32().ok_or(Tanks::new())?;
718+ let bloq = bloq.as_u32().ok_or(TTanks::new())?;
707− let b = b.as_atom().ok_or(Tanks::new())?;
719+ let b = b.as_atom().ok_or(TTanks::new())?;
708− let c = c.as_atom().ok_or(Tanks::new())?;
720+ let c = c.as_atom().ok_or(TTanks::new())?;
710 Ok(Rc::new(Noun::Atom(
722 Ok(Rc::new(Noun::Atom(
711 (c << (met(bloq, &b) * 2u32.pow(bloq))) | b,
723 (c << (met(bloq, &b) * 2u32.pow(bloq))) | b,
@@ -713,8 +725,8 @@ static CAT: Jet = |_ctx, n| {
715static MET: Jet = |_ctx, n| {
727static MET: Jet = |_ctx, n| {
716− let (bloq, b) = n.as_cell().ok_or(Tanks::new())?;
728+ let (bloq, b) = n.as_cell().ok_or(TTanks::new())?;
717− let b: Atom = b.as_atom().ok_or(Tanks::new())?.clone();
729+ let b: Atom = b.as_atom().ok_or(TTanks::new())?.clone();
718 let bloq = bloq.as_u32().unwrap();
730 let bloq = bloq.as_u32().unwrap();
720 Ok(Rc::new(Noun::from_u32(met(bloq, &b))))
732 Ok(Rc::new(Noun::from_u32(met(bloq, &b))))
@@ -725,28 +737,28 @@ fn met(bloq: u32, a: &Atom) -> u32 {
727static CUT: Jet = |ctx, n| {
739static CUT: Jet = |ctx, n| {
728− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
740+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
729− let (b, d) = b.as_cell().ok_or(Tanks::new())?;
741+ let (b, d) = b.as_cell().ok_or(TTanks::new())?;
730− let (b, c) = b.as_cell().ok_or(Tanks::new())?;
742+ let (b, c) = b.as_cell().ok_or(TTanks::new())?;
732 let bits = 2u32.pow(a.as_u32().unwrap());
744 let bits = 2u32.pow(a.as_u32().unwrap());
734 let mask = (&ctx.big_uints.one << (bits * c.as_u32().unwrap())) - &ctx.big_uints.one;
746 let mask = (&ctx.big_uints.one << (bits * c.as_u32().unwrap())) - &ctx.big_uints.one;
736 Ok(Rc::new(Noun::Atom(
748 Ok(Rc::new(Noun::Atom(
737− (d.as_atom().ok_or(Tanks::new())? >> (bits * b.as_u32().unwrap())) & mask,
749+ (d.as_atom().ok_or(TTanks::new())? >> (bits * b.as_u32().unwrap())) & mask,
741static FIL: Jet = |ctx, n| {
753static FIL: Jet = |ctx, n| {
742− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
754+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
743− let (b, c) = b.as_cell().ok_or(Tanks::new())?;
755+ let (b, c) = b.as_cell().ok_or(TTanks::new())?;
745 let bits = 2u32.pow(a.as_u32().unwrap());
757 let bits = 2u32.pow(a.as_u32().unwrap());
747 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
759 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
749− let src = c.as_atom().ok_or(Tanks::new())? & mask;
761+ let src = c.as_atom().ok_or(TTanks::new())? & mask;
751 let mut target = ctx.big_uints.zero.clone();
763 let mut target = ctx.big_uints.zero.clone();
@@ -758,30 +770,30 @@ static FIL: Jet = |ctx, n| {
760static LSH: Jet = |_ctx, n| {
772static LSH: Jet = |_ctx, n| {
761− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
773+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
762 let a = a.as_bite();
774 let a = a.as_bite();
763− let b = b.as_atom().ok_or(Tanks::new())?;
775+ let b = b.as_atom().ok_or(TTanks::new())?;
765 Ok(Rc::new(Noun::Atom(b << a.bits())))
777 Ok(Rc::new(Noun::Atom(b << a.bits())))
768static RSH: Jet = |_ctx, n| {
780static RSH: Jet = |_ctx, n| {
769− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
781+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
770 let a = a.as_bite();
782 let a = a.as_bite();
771− let b = b.as_atom().ok_or(Tanks::new())?;
783+ let b = b.as_atom().ok_or(TTanks::new())?;
773 Ok(Rc::new(Noun::Atom(b >> a.bits())))
785 Ok(Rc::new(Noun::Atom(b >> a.bits())))
776−static RAP: Jet = |ctx, n| {
788+pub static RAP: Jet = |ctx, n| {
777− let (bloq, b) = n.as_cell().ok_or(Tanks::new())?;
789+ let (bloq, b) = n.as_cell().ok_or(TTanks::new())?;
778 let bloq = bloq.as_u32().unwrap();
790 let bloq = bloq.as_u32().unwrap();
779 let bits = 2u32.pow(bloq);
791 let bits = 2u32.pow(bloq);
781 let mut target = ctx.big_uints.zero.clone();
793 let mut target = ctx.big_uints.zero.clone();
783 for el in b.list_iter().collect::<Vec<_>>().iter().rev() {
795 for el in b.list_iter().collect::<Vec<_>>().iter().rev() {
784− let el = el.as_atom().ok_or(Tanks::new())?;
796+ let el = el.as_atom().ok_or(TTanks::new())?;
785 if el != &ctx.big_uints.zero {
797 if el != &ctx.big_uints.zero {
786 target = (target << (bits * met(bloq, &el))) | el;
798 target = (target << (bits * met(bloq, &el))) | el;
@@ -791,7 +803,7 @@ static RAP: Jet = |ctx, n| {
793static REP: Jet = |ctx, n| {
805static REP: Jet = |ctx, n| {
794− let (bite, b) = n.as_cell().ok_or(Tanks::new())?;
806+ let (bite, b) = n.as_cell().ok_or(TTanks::new())?;
795 let bite = bite.as_bite();
807 let bite = bite.as_bite();
797 let bits = bite.bits();
809 let bits = bite.bits();
@@ -800,18 +812,18 @@ static REP: Jet = |ctx, n| {
800 let mut target = ctx.big_uints.zero.clone();
812 let mut target = ctx.big_uints.zero.clone();
802 for el in b.list_iter().collect::<Vec<_>>().iter().rev() {
814 for el in b.list_iter().collect::<Vec<_>>().iter().rev() {
803− target = (target << bits) | (el.as_atom().ok_or(Tanks::new())? & &mask);
815+ target = (target << bits) | (el.as_atom().ok_or(TTanks::new())? & &mask);
806 Ok(Rc::new(Noun::Atom(target)))
818 Ok(Rc::new(Noun::Atom(target)))
809static REV: Jet = |ctx, n| {
821static REV: Jet = |ctx, n| {
810− let (bloq, b) = n.as_cell().ok_or(Tanks::new())?;
822+ let (bloq, b) = n.as_cell().ok_or(TTanks::new())?;
811− let (len, dat) = b.as_cell().ok_or(Tanks::new())?;
823+ let (len, dat) = b.as_cell().ok_or(TTanks::new())?;
812 let bloq = bloq.as_u32().unwrap();
824 let bloq = bloq.as_u32().unwrap();
813 let len = len.as_u32().unwrap();
825 let len = len.as_u32().unwrap();
814− let mut dat: Atom = dat.as_atom().ok_or(Tanks::new())?.clone();
826+ let mut dat: Atom = dat.as_atom().ok_or(TTanks::new())?.clone();
816 let bits = 2u32.pow(bloq);
828 let bits = 2u32.pow(bloq);
817 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
829 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
@@ -827,9 +839,9 @@ static REV: Jet = |ctx, n| {
829static RIP: Jet = |ctx, n| {
841static RIP: Jet = |ctx, n| {
830− let (bite, b) = n.as_cell().ok_or(Tanks::new())?;
842+ let (bite, b) = n.as_cell().ok_or(TTanks::new())?;
831 let bite = bite.as_bite();
843 let bite = bite.as_bite();
832− let mut b: Atom = b.as_atom().ok_or(Tanks::new())?.clone();
844+ let mut b: Atom = b.as_atom().ok_or(TTanks::new())?.clone();
834 let bits = bite.bits();
846 let bits = bite.bits();
835 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
847 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
@@ -845,11 +857,11 @@ static RIP: Jet = |ctx, n| {
847static RUN: Jet = |ctx, n| {
859static RUN: Jet = |ctx, n| {
848− let (bite, b) = n.as_cell().ok_or(Tanks::new())?;
860+ let (bite, b) = n.as_cell().ok_or(TTanks::new())?;
849− let (b, gate) = b.as_cell().ok_or(Tanks::new())?;
861+ let (b, gate) = b.as_cell().ok_or(TTanks::new())?;
851 let bite = bite.as_bite();
863 let bite = bite.as_bite();
852− let mut b: Atom = b.as_atom().ok_or(Tanks::new())?.clone();
864+ let mut b: Atom = b.as_atom().ok_or(TTanks::new())?.clone();
854 let bits = bite.bits();
866 let bits = bite.bits();
855 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
867 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
@@ -860,7 +872,7 @@ static RUN: Jet = |ctx, n| {
860 target = (target << bits)
872 target = (target << bits)
861 | ((*slam_pulled_gate(ctx, gate, &Rc::new(Noun::Atom(&mask & &b)))?)
873 | ((*slam_pulled_gate(ctx, gate, &Rc::new(Noun::Atom(&mask & &b)))?)
862 .as_atom()
874 .as_atom()
863− .ok_or(Tanks::new())?
875+ .ok_or(TTanks::new())?
864 & &mask);
876 & &mask);
865 b = b >> bits;
877 b = b >> bits;
@@ -869,11 +881,11 @@ static RUN: Jet = |ctx, n| {
871static RUT: Jet = |ctx, n| {
883static RUT: Jet = |ctx, n| {
872− let (bite, b) = n.as_cell().ok_or(Tanks::new())?;
884+ let (bite, b) = n.as_cell().ok_or(TTanks::new())?;
873− let (b, gate) = b.as_cell().ok_or(Tanks::new())?;
885+ let (b, gate) = b.as_cell().ok_or(TTanks::new())?;
875 let bite = bite.as_bite();
887 let bite = bite.as_bite();
876− let mut b: Atom = b.as_atom().ok_or(Tanks::new())?.clone();
888+ let mut b: Atom = b.as_atom().ok_or(TTanks::new())?.clone();
878 let bits = bite.bits();
890 let bits = bite.bits();
879 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
891 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
@@ -884,7 +896,7 @@ static RUT: Jet = |ctx, n| {
884 target.push(
896 target.push(
885 (*slam_pulled_gate(ctx, gate, &Rc::new(Noun::Atom(&mask & &b)))?)
897 (*slam_pulled_gate(ctx, gate, &Rc::new(Noun::Atom(&mask & &b)))?)
886 .as_atom()
898 .as_atom()
887− .ok_or(Tanks::new())?
899+ .ok_or(TTanks::new())?
890 b = b >> bits;
902 b = b >> bits;
@@ -894,12 +906,12 @@ static RUT: Jet = |ctx, n| {
896static SEW: Jet = |ctx, n| {
908static SEW: Jet = |ctx, n| {
897− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
909+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
898− let (b, recipient) = b.as_cell().ok_or(Tanks::new())?;
910+ let (b, recipient) = b.as_cell().ok_or(TTanks::new())?;
899− let (sew_start, c) = b.as_cell().ok_or(Tanks::new())?;
911+ let (sew_start, c) = b.as_cell().ok_or(TTanks::new())?;
900− let (number_of_blocks, donor) = c.as_cell().ok_or(Tanks::new())?;
912+ let (number_of_blocks, donor) = c.as_cell().ok_or(TTanks::new())?;
901− let recipient = recipient.as_atom().ok_or(Tanks::new())?;
913+ let recipient = recipient.as_atom().ok_or(TTanks::new())?;
902− let donor = donor.as_atom().ok_or(Tanks::new())?;
914+ let donor = donor.as_atom().ok_or(TTanks::new())?;
904 let bloq = a.as_u32().unwrap();
916 let bloq = a.as_u32().unwrap();
905 let bits = 2u32.pow(bloq);
917 let bits = 2u32.pow(bloq);
@@ -915,12 +927,12 @@ static SEW: Jet = |ctx, n| {
917static SWP: Jet = |ctx, n| {
929static SWP: Jet = |ctx, n| {
918− let (bloq, b) = n.as_cell().ok_or(Tanks::new())?;
930+ let (bloq, b) = n.as_cell().ok_or(TTanks::new())?;
919 let bloq = bloq.as_u32().unwrap();
931 let bloq = bloq.as_u32().unwrap();
920 let bits = 2u32.pow(bloq);
932 let bits = 2u32.pow(bloq);
921 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
933 let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
923− let mut source = b.as_atom().ok_or(Tanks::new())?.clone();
935+ let mut source = b.as_atom().ok_or(TTanks::new())?.clone();
924 let mut target = ctx.big_uints.zero.clone();
936 let mut target = ctx.big_uints.zero.clone();
926 while source > ctx.big_uints.zero {
938 while source > ctx.big_uints.zero {
@@ -932,7 +944,7 @@ static SWP: Jet = |ctx, n| {
934static XEB: Jet = |_ctx, n| {
946static XEB: Jet = |_ctx, n| {
935− let mut a = n.as_atom().ok_or(Tanks::new())?.clone();
947+ let mut a = n.as_atom().ok_or(TTanks::new())?.clone();
937 let mut c = 0;
949 let mut c = 0;
@@ -949,22 +961,22 @@ static DIS: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a & b);
949static MIX: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a ^ b);
961static MIX: Jet = |_ctx, n| BINARY_ATOM(n, |a, b| a ^ b);
951static NOT: Jet = |ctx, n| {
963static NOT: Jet = |ctx, n| {
952− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
964+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
953− let (b, c) = b.as_cell().ok_or(Tanks::new())?;
965+ let (b, c) = b.as_cell().ok_or(TTanks::new())?;
955 let bloq = a.as_u32().unwrap();
967 let bloq = a.as_u32().unwrap();
956 let bits = 2u32.pow(bloq);
968 let bits = 2u32.pow(bloq);
957 let mask = (&ctx.big_uints.one << (bits * b.as_u32().unwrap())) - &ctx.big_uints.one;
969 let mask = (&ctx.big_uints.one << (bits * b.as_u32().unwrap())) - &ctx.big_uints.one;
959− let target = c.as_atom().ok_or(Tanks::new())? ^ &mask;
971+ let target = c.as_atom().ok_or(TTanks::new())? ^ &mask;
961 Ok(Rc::new(Noun::Atom(target)))
973 Ok(Rc::new(Noun::Atom(target)))
964static LAST: Jet = |_ctx, n| {
976static LAST: Jet = |_ctx, n| {
965− let (a, b) = n.as_cell().ok_or(Tanks::new())?;
977+ let (a, b) = n.as_cell().ok_or(TTanks::new())?;
966− let a = a.as_hair().ok_or(Tanks::new())?;
978+ let a = a.as_hair().ok_or(TTanks::new())?;
967− let b = b.as_hair().ok_or(Tanks::new())?;
979+ let b = b.as_hair().ok_or(TTanks::new())?;
968 Ok(Noun::from_hair(last(&a, &b)))
980 Ok(Noun::from_hair(last(&a, &b)))
@@ -985,22 +997,185 @@ fn last<'a>(a: &'a Hair, b: &'a Hair) -> &'a Hair {
987static TRIP: Jet = |_ctx, n| {
999static TRIP: Jet = |_ctx, n| {
988− let a = n.as_atom().ok_or(Tanks::new())?;
1000+ let a = n.as_atom().ok_or(TTanks::new())?;
989 Ok(Noun::list(
1001 Ok(Noun::list(
990 a.to_bytes_le().iter().map(|b| Noun::from_u32(*b as u32)),
1002 a.to_bytes_le().iter().map(|b| Noun::from_u32(*b as u32)),
994static MUK: Jet = |_ctx, n| {
1006static MUK: Jet = |_ctx, n| {
995− let (seed, len) = n.as_cell().ok_or(Tanks::new())?;
1007+ let (seed, len) = n.as_cell().ok_or(TTanks::new())?;
996− let (len, key) = len.as_cell().ok_or(Tanks::new())?;
1008+ let (len, key) = len.as_cell().ok_or(TTanks::new())?;
997− let seed = seed.as_u32().ok_or(Tanks::new())?;
1009+ let seed = seed.as_u32().ok_or(TTanks::new())?;
998− let len = len.as_u32().ok_or(Tanks::new())?;
1010+ let len = len.as_u32().ok_or(TTanks::new())?;
999− let key = key.as_atom().ok_or(Tanks::new())?;
1011+ let key = key.as_atom().ok_or(TTanks::new())?;
1001 Ok(Rc::new(Noun::from_u32(muk(seed, len, key))))
1013 Ok(Rc::new(Noun::from_u32(muk(seed, len, key))))
1016+static AOR: Jet = |ctx, n| {
1017+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1020+ Ok(ctx.nouns.y.clone())
1022+ match (a.borrow(), b.borrow()) {
1023+ (Noun::Cell { .. }, Noun::Atom(_)) => Ok(ctx.nouns.n.clone()),
1024+ (Noun::Cell { p: a_p, q: a_q, .. }, Noun::Cell { p: b_p, q: b_q, .. }) => {
1026+ AOR(ctx, &cell(a_q, b_q))
1028+ AOR(ctx, &cell(a_p, b_p))
1031+ (Noun::Atom(_), Noun::Cell { .. }) => Ok(ctx.nouns.y.clone()),
1032+ (Noun::Atom(a), Noun::Atom(b)) => {
1033+ let a = a.to_bytes_le();
1034+ let b = b.to_bytes_le();
1038+ let c = a.get(i).unwrap_or(&0);
1039+ let d = b.get(i).unwrap_or(&0);
1045+ return Ok(ctx.nouns.y.clone());
1047+ return Ok(ctx.nouns.n.clone());
1056+static DOR: Jet = |ctx, n| {
1057+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1060+ Ok(ctx.nouns.y.clone())
1062+ match (a.borrow(), b.borrow()) {
1063+ (Noun::Cell { .. }, Noun::Atom(_)) => Ok(ctx.nouns.n.clone()),
1064+ (Noun::Cell { p: a_p, q: a_q, .. }, Noun::Cell { p: b_p, q: b_q, .. }) => {
1066+ DOR(ctx, &cell(a_q, b_q))
1068+ DOR(ctx, &cell(a_p, b_p))
1071+ (Noun::Atom(_), Noun::Cell { .. }) => Ok(ctx.nouns.y.clone()),
1072+ (Noun::Atom(a), Noun::Atom(b)) => {
1074+ Ok(ctx.nouns.y.clone())
1076+ Ok(ctx.nouns.n.clone())
1083+static GOR: Jet = |ctx, n| {
1084+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1092+ Ok(ctx.nouns.y.clone())
1094+ Ok(ctx.nouns.n.clone())
1099+static GOR_PAIR: fn(&mut InterpreterContext, &Rc<Noun>, &Rc<Noun>) -> Result<bool, TTanks> =
1105+ Ok(DOR(ctx, &(a.clone(), b.clone()).as_noun())? == ctx.nouns.y)
1111+static MOR: Jet = |ctx, n| {
1112+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1113+ let c = Noun::from_u32(a.mug()).mug();
1114+ let d = Noun::from_u32(b.mug()).mug();
1120+ Ok(ctx.nouns.y.clone())
1122+ Ok(ctx.nouns.n.clone())
1127+static LOOK: Jet = |ctx, n| {
1128+ let (cog, dab) = n.as_cell().ok_or(EMPTY_TANKS)?;
1129+ LOOK_PAIR(ctx, Atom::new(vec![1]), cog, dab)
1132+static LOOK_PAIR: fn(
1133+ &mut InterpreterContext,
1137+) -> Result<Rc<Noun>, TTanks> = |ctx, axe, cog, dab| {
1139+ Ok(ctx.nouns.sig.clone())
1141+ let (node, b, c) = dab.tuple_3().ok_or(EMPTY_TANKS)?;
1144+ let (p, q) = node.as_cell().ok_or(EMPTY_TANKS)?;
1145+ if b.is_sig() && c.is_sig() {
1147+ Ok((ctx.nouns.sig.clone(), Noun::Atom(axe), q.clone()).as_noun())
1149+ Ok(ctx.nouns.sig.clone())
1151+ } else if b.is_sig() {
1153+ Ok((ctx.nouns.sig.clone(), PEG_U32(&axe, 2), q.clone()).as_noun())
1154+ } else if GOR_PAIR(ctx, cog, p)? {
1155+ Ok(ctx.nouns.sig.clone())
1157+ LOOK_PAIR(ctx, PEG_U32(&axe, 3), cog, r)
1159+ } else if c.is_sig() {
1161+ Ok((ctx.nouns.sig.clone(), PEG_U32(&axe, 2), q.clone()).as_noun())
1162+ } else if GOR_PAIR(ctx, cog, p)? {
1163+ LOOK_PAIR(ctx, PEG_U32(&axe, 3), cog, l)
1165+ Ok(ctx.nouns.sig.clone())
1169+ Ok((ctx.nouns.sig.clone(), PEG_U32(&axe, 2), q.clone()).as_noun())
1170+ } else if GOR_PAIR(ctx, cog, p)? {
1171+ LOOK_PAIR(ctx, PEG_U32(&axe, 6), cog, l)
1173+ LOOK_PAIR(ctx, PEG_U32(&axe, 7), cog, r)
1004static JUST: DoubleJet = |ctx, n, m| {
1179static JUST: DoubleJet = |ctx, n, m| {
1005 let char = n.as_atom()?;
1180 let char = n.as_atom()?;
1006 let nail = m.as_nail()?;
1181 let nail = m.as_nail()?;