@@ -47,8 +47,8 @@ pub fn generate_interpreter_context() -> InterpreterContext {
4747 let two = Rc::new(Noun::Atom(big_uints.two.clone()));
4848 let three = Rc::new(Noun::Atom(big_uints.three.clone()));
4949 let four = Rc::new(Noun::Atom(big_uints.four.clone()));
50− let sig_one = cell(sig.clone(), one.clone());
51− let two_three = cell(two.clone(), three.clone());
50+ let sig_one = cell(&sig, &one);
51+ let two_three = cell(&two, &three);
5252 InterpreterContext {
5353 jets,
5454 double_jets,
@@ -67,21 +67,21 @@ pub fn generate_interpreter_context() -> InterpreterContext {
6767 }
6868}
6969
70−fn wut(ctx: &InterpreterContext, noun: Rc<Noun>) -> Rc<Noun> {
71− match *noun {
70+fn wut(ctx: &InterpreterContext, noun: &Noun) -> Rc<Noun> {
71+ match noun {
7272 Noun::Cell { .. } => ctx.nouns.sig.clone(),
7373 Noun::Atom(_) => ctx.nouns.one.clone(),
7474 }
7575}
7676
77−fn lus(noun: Rc<Noun>) -> Option<Noun> {
77+fn lus(noun: &Noun) -> Option<Noun> {
7878 match (*noun).clone() {
7979 Noun::Cell { .. } => None,
8080 Noun::Atom(atm) => Some(Noun::Atom(atm + 1u32)),
8181 }
8282}
8383
84−fn tis(ctx: &InterpreterContext, lhs: Rc<Noun>, rhs: Rc<Noun>) -> Rc<Noun> {
84+fn tis(ctx: &InterpreterContext, lhs: &Noun, rhs: &Noun) -> Rc<Noun> {
8585 if lhs == rhs {
8686 ctx.nouns.sig.clone()
8787 } else {
@@ -89,14 +89,14 @@ fn tis(ctx: &InterpreterContext, lhs: Rc<Noun>, rhs: Rc<Noun>) -> Rc<Noun> {
8989 }
9090}
9191
92−fn fas(ctx: &InterpreterContext, addr: Atom, noun: &Noun) -> Option<Rc<Noun>> {
92+fn fas(ctx: &InterpreterContext, addr: &Atom, noun: &Noun) -> Option<Rc<Noun>> {
9393 let mut addr_iter = addr.iter_u32_digits();
9494
9595 match addr_iter.len() {
9696 0 => None,
9797 1 => Some(fas_u32(addr_iter.next()?, noun)?),
9898 _ => {
99− let rest = fas(ctx, &addr >> 1, noun)?;
99+ let rest = fas(ctx, &(addr >> 1u8), noun)?;
100100 Some(fas_u32(
101101 if (addr & &ctx.big_uints.one) == ctx.big_uints.one {
102102 3
@@ -119,7 +119,7 @@ fn fas_u32(addr: u32, noun: &Noun) -> Option<Rc<Noun>> {
119119 2 => Some(p.clone()),
120120 3 => Some(q.clone()),
121121 _ => {
122− let rest = fas_u32(n >> 1, &naked_cell(p.clone(), q.clone()))?;
122+ let rest = fas_u32(n >> 1, &naked_cell(&p, &q))?;
123123 fas_u32(if (n & 1) == 1 { 3 } else { 2 }, &rest)
124124 }
125125 },
@@ -134,9 +134,11 @@ fn hax_u32(addr: u32, new_value: Rc<Noun>, target: Rc<Noun>) -> Option<Rc<Noun>>
134134 _ => hax_u32(
135135 addr >> 1,
136136 if (addr & 1) == 1 {
137− cell(fas_u32(addr - 1, &target)?, new_value)
137+ let foo = fas_u32(addr - 1, &target)?;
138+ cell(&foo, &new_value)
138139 } else {
139− cell(new_value, fas_u32(addr + 1, &target)?)
140+ let foo = fas_u32(addr + 1, &target)?;
141+ cell(&new_value, &foo)
140142 },
141143 target,
142144 ),
@@ -158,9 +160,11 @@ fn hax(
158160 ctx,
159161 &addr >> 1u32,
160162 if (&addr & &ctx.big_uints.one) == ctx.big_uints.one {
161− cell(fas(ctx, addr - &ctx.big_uints.one, &target)?, new_value)
163+ let foo = fas(ctx, &(addr - &ctx.big_uints.one), &target)?;
164+ cell(&foo, &new_value)
162165 } else {
163− cell(new_value, fas(ctx, addr + &ctx.big_uints.one, &target)?)
166+ let foo = fas(ctx, &(addr + &ctx.big_uints.one), &target)?;
167+ cell(&new_value, &foo)
164168 },
165169 target,
166170 ),
@@ -171,7 +175,7 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
171175 match op {
172176 0 => {
173177 let b = formula.as_atom()?.clone();
174− fas(ctx, b, subj)
178+ fas(ctx, &b, subj)
175179 }
176180 1 => Some(formula),
177181 2 => {
@@ -181,7 +185,7 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
181185 Noun::Cell { p, q, .. }
182186 if *p == Noun::SIG
183187 && q == ctx.nouns.two
184− && b == cell(Rc::new(Noun::SIG), ctx.nouns.one.clone()) =>
188+ && b == cell(&Noun::SIG, &ctx.nouns.one) =>
185189 {
186190 // This means we are about the evaluate a gate at the head of the current subject.
187191 let (hash, sample) = subj.hash_gate();
@@ -208,12 +212,19 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
208212 }
209213 }
210214 }
211− 3 => Some(wut(ctx, tar(ctx, subj, &formula)?)),
212− 4 => Some(Rc::new(lus(tar(ctx, subj, &formula)?)?)),
215+ 3 => {
216+ let foo = tar(ctx, subj, &formula)?;
217+ Some(wut(ctx, &foo))
218+ }
219+ 4 => {
220+ let foo = tar(ctx, subj, &formula)?;
221+ Some(Rc::new(lus(&foo)?))
222+ }
213223 5 => {
214224 let (b, c) = formula.as_cell()?;
215225 let foo = tar(ctx, &subj, &b)?;
216− Some(tis(ctx, foo, tar(ctx, subj, &c)?))
226+ let bar = tar(ctx, subj, &c)?;
227+ Some(tis(ctx, &foo, &bar))
217228 }
218229 6 => {
219230 let (b, c) = formula.as_cell()?;
@@ -221,13 +232,13 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
221232
222233 let foo = tar_u32(
223234 ctx,
224− &cell(c, d),
235+ &cell(&c, &d),
225236 0,
226237 tar_u32(
227238 ctx,
228239 &ctx.nouns.two_three,
229240 0,
230− tar_u32(ctx, subj, 4, cell(ctx.nouns.four.clone(), b))?,
241+ tar_u32(ctx, subj, 4, cell(&ctx.nouns.four, &b))?,
231242 )?,
232243 )?;
233244
@@ -240,7 +251,8 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
240251 }
241252 8 => {
242253 let (b, c) = formula.as_cell()?;
243− tar(ctx, &cell(tar(ctx, &subj, &b)?, Rc::new(subj.clone())), &c)
254+ let foo = tar(ctx, &subj, &b)?;
255+ tar(ctx, &cell(&foo, subj), &c)
244256 }
245257 9 => {
246258 let (b, c) = formula.as_cell()?;
@@ -249,7 +261,7 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
249261 ctx,
250262 &foo,
251263 2,
252− cell(ctx.nouns.sig_one.clone(), cell(ctx.nouns.sig.clone(), b)),
264+ cell(&ctx.nouns.sig_one, &cell(&ctx.nouns.sig, &b)),
253265 )
254266 }
255267 10 => {
@@ -264,12 +276,11 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
264276 // println!("{b}");
265277 match (*b).clone() {
266278 Noun::Atom(_) => tar(ctx, subj, &d),
267− Noun::Cell { q: c, .. } => tar_u32(
268− ctx,
269− &cell(tar(ctx, subj, &c)?, tar(ctx, subj, &d)?),
270− 0,
271− ctx.nouns.three.clone(),
272− ),
279+ Noun::Cell { q: c, .. } => {
280+ let foo = tar(ctx, subj, &c)?;
281+ let bar = tar(ctx, subj, &d)?;
282+ tar_u32(ctx, &cell(&foo, &bar), 0, ctx.nouns.three.clone())
283+ }
273284 }
274285 }
275286 _ => None,
@@ -279,7 +290,11 @@ fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) ->
279290pub fn tar(ctx: &InterpreterContext, subj: &Noun, formula: &Noun) -> Option<Rc<Noun>> {
280291 let (op, formula) = formula.as_cell()?;
281292 match *op {
282− Noun::Cell { .. } => Some(cell(tar(ctx, subj, &op)?, tar(ctx, subj, &formula)?)),
293+ Noun::Cell { .. } => {
294+ let foo = tar(ctx, subj, &op)?;
295+ let bar = tar(ctx, subj, &formula)?;
296+ Some(cell(&foo, &bar))
297+ }
283298 Noun::Atom(ref op) => {
284299 let mut op_iter = op.iter_u32_digits();
285300 let op = match op_iter.len() {
@@ -298,11 +313,8 @@ pub fn eval_gate(ctx: &InterpreterContext, gate: Rc<Noun>) -> Option<Rc<Noun>> {
298313 ctx,
299314 &gate,
300315 &cell(
301− Rc::new(Noun::Atom(BigUint::new(vec![9]))),
302− cell(
303− ctx.nouns.two.clone(),
304− cell(ctx.nouns.sig.clone(), ctx.nouns.one.clone()),
305− ),
316+ &Noun::Atom(BigUint::new(vec![9])),
317+ &cell(&ctx.nouns.two, &cell(&ctx.nouns.sig, &ctx.nouns.one)),
306318 ),
307319 )
308320}
@@ -311,5 +323,5 @@ pub fn slam(ctx: &InterpreterContext, gate: Rc<Noun>, sample: Rc<Noun>) -> Optio
311323 let (battery, payload) = gate.as_cell()?;
312324 let (_sample, context) = payload.as_cell()?;
313325
314− eval_gate(ctx, cell(battery, cell(sample, context)))
326+ eval_gate(ctx, cell(&battery, &cell(&sample, &context)))
315327}