@@ -10,7 +10,7 @@ use std::{
11use crate::{
11use crate::{
12 interpreter::{slam_pulled_gate, InterpreterContext, TTanks, EMPTY_TANKS},
12 interpreter::{slam_pulled_gate, InterpreterContext, TTanks, EMPTY_TANKS},
13− noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
13+ noun::{self, cell, AsNoun, Atom, Edge, Hair, Nail, Noun},
16fn 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>>>(
@@ -112,6 +112,7 @@ pub fn generate_jets() -> Jets {
112 (299422828284010240628877806738195667652, DOR),
112 (299422828284010240628877806738195667652, DOR),
113 (166326796552601297695313176538120818632, GOR),
113 (166326796552601297695313176538120818632, GOR),
114 (7942398240152905363972500667649380756, MOR),
114 (7942398240152905363972500667649380756, MOR),
115+ (315687984998079865981003916817293521765, LOOK),
@@ -1095,6 +1096,18 @@ static GOR: Jet = |ctx, n| {
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)
1098static MOR: Jet = |ctx, n| {
1111static MOR: Jet = |ctx, n| {
1099 let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1112 let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1100 let c = Noun::from_u32(a.mug()).mug();
1113 let c = Noun::from_u32(a.mug()).mug();
@@ -1111,6 +1124,58 @@ static MOR: Jet = |ctx, n| {
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)
1114static JUST: DoubleJet = |ctx, n, m| {
1179static JUST: DoubleJet = |ctx, n, m| {
1115 let char = n.as_atom()?;
1180 let char = n.as_atom()?;
1116 let nail = m.as_nail()?;
1181 let nail = m.as_nail()?;