@@ -89,7 +89,7 @@ fn tis(ctx: &InterpreterContext, lhs: Rc<Noun>, rhs: Rc<Noun>) -> Rc<Noun> {
8989 }
9090}
9191
92−fn fas(ctx: &InterpreterContext, addr: Atom, noun: Rc<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() {
@@ -103,24 +103,24 @@ fn fas(ctx: &InterpreterContext, addr: Atom, noun: Rc<Noun>) -> Option<Rc<Noun>>
103103 } else {
104104 2
105105 },
106− rest,
106+ &rest,
107107 )?)
108108 }
109109 }
110110}
111111
112−fn fas_u32(addr: u32, noun: Rc<Noun>) -> Option<Rc<Noun>> {
112+fn fas_u32(addr: u32, noun: &Noun) -> Option<Rc<Noun>> {
113113 match addr {
114114 0 => None,
115− 1 => Some(noun),
116− n => match (*noun).clone() {
115+ 1 => Some(Rc::new(noun.clone())),
116+ n => match noun {
117117 Noun::Atom(_) => None,
118118 Noun::Cell { p, q, .. } => match n {
119− 2 => Some(p),
120− 3 => Some(q),
119+ 2 => Some(p.clone()),
120+ 3 => Some(q.clone()),
121121 _ => {
122− let rest = fas_u32(n >> 1, cell(p, q))?;
123− fas_u32(if (n & 1) == 1 { 3 } else { 2 }, rest)
122+ let rest = fas_u32(n >> 1, &naked_cell(p.clone(), q.clone()))?;
123+ fas_u32(if (n & 1) == 1 { 3 } else { 2 }, &rest)
124124 }
125125 },
126126 },
@@ -134,9 +134,9 @@ 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.clone())?, new_value)
137+ cell(fas_u32(addr - 1, &target)?, new_value)
138138 } else {
139− cell(new_value, fas_u32(addr + 1, target.clone())?)
139+ cell(new_value, fas_u32(addr + 1, &target)?)
140140 },
141141 target,
142142 ),
@@ -158,27 +158,16 @@ fn hax(
158158 ctx,
159159 &addr >> 1u32,
160160 if (&addr & &ctx.big_uints.one) == ctx.big_uints.one {
161− cell(
162− fas(ctx, addr - &ctx.big_uints.one, target.clone())?,
163− new_value,
164− )
161+ cell(fas(ctx, addr - &ctx.big_uints.one, &target)?, new_value)
165162 } else {
166− cell(
167− new_value,
168− fas(ctx, addr + &ctx.big_uints.one, target.clone())?,
169− )
163+ cell(new_value, fas(ctx, addr + &ctx.big_uints.one, &target)?)
170164 },
171165 target,
172166 ),
173167 }
174168}
175169
176−fn tar_u32(
177− ctx: &InterpreterContext,
178− subj: Rc<Noun>,
179− op: u32,
180− formula: Rc<Noun>,
181−) -> Option<Rc<Noun>> {
170+fn tar_u32(ctx: &InterpreterContext, subj: &Noun, op: u32, formula: Rc<Noun>) -> Option<Rc<Noun>> {
182171 match op {
183172 0 => {
184173 let b = formula.as_atom()?.clone();
@@ -203,53 +192,62 @@ fn tar_u32(
203192 let (hash, sample_1, sample_2) = subj.hash_double_gate();
204193 match ctx.double_jets.get(&hash) {
205194 Some(f) => f(ctx, sample_1, sample_2),
206− None => tar(ctx, tar(ctx, subj.clone(), b)?, tar(ctx, subj, c)?),
195+ None => {
196+ let foo = tar(ctx, subj, &b)?;
197+ let bar = tar(ctx, subj, &c)?;
198+ tar(ctx, &foo, &bar)
199+ }
207200 }
208201 }
209202 }
210203 }
211− _ => tar(ctx, tar(ctx, subj.clone(), b)?, tar(ctx, subj, c)?),
204+ _ => {
205+ let foo = tar(ctx, &subj, &b)?;
206+ let bar = tar(ctx, &subj, &c)?;
207+ tar(ctx, &foo, &bar)
208+ }
212209 }
213210 }
214− 3 => Some(wut(ctx, tar(ctx, subj, formula)?)),
215− 4 => Some(Rc::new(lus(tar(ctx, subj, formula)?)?)),
211+ 3 => Some(wut(ctx, tar(ctx, subj, &formula)?)),
212+ 4 => Some(Rc::new(lus(tar(ctx, subj, &formula)?)?)),
216213 5 => {
217214 let (b, c) = formula.as_cell()?;
218− Some(tis(ctx, tar(ctx, subj.clone(), b)?, tar(ctx, subj, c)?))
215+ let foo = tar(ctx, &subj, &b)?;
216+ Some(tis(ctx, foo, tar(ctx, subj, &c)?))
219217 }
220218 6 => {
221219 let (b, c) = formula.as_cell()?;
222220 let (c, d) = c.as_cell()?;
223221
224− tar(
222+ let foo = tar_u32(
225223 ctx,
226− subj.clone(),
224+ &cell(c, d),
225+ 0,
227226 tar_u32(
228227 ctx,
229− cell(c, d),
228+ &ctx.nouns.two_three,
230229 0,
231− tar_u32(
232− ctx,
233− ctx.nouns.two_three.clone(),
234− 0,
235− tar_u32(ctx, subj, 4, cell(ctx.nouns.four.clone(), b))?,
236− )?,
230+ tar_u32(ctx, subj, 4, cell(ctx.nouns.four.clone(), b))?,
237231 )?,
238− )
232+ )?;
233+
234+ tar(ctx, &subj, &foo)
239235 }
240236 7 => {
241237 let (b, c) = formula.as_cell()?;
242− tar(ctx, tar(ctx, subj, b)?, c)
238+ let foo = tar(ctx, subj, &b)?;
239+ tar(ctx, &foo, &c)
243240 }
244241 8 => {
245242 let (b, c) = formula.as_cell()?;
246− tar(ctx, cell(tar(ctx, subj.clone(), b)?, subj), c)
243+ tar(ctx, &cell(tar(ctx, &subj, &b)?, Rc::new(subj.clone())), &c)
247244 }
248245 9 => {
249246 let (b, c) = formula.as_cell()?;
247+ let foo = tar(ctx, &subj, &c)?;
250248 tar_u32(
251249 ctx,
252− tar(ctx, subj, c)?,
250+ &foo,
253251 2,
254252 cell(ctx.nouns.sig_one.clone(), cell(ctx.nouns.sig.clone(), b)),
255253 )
@@ -259,21 +257,16 @@ fn tar_u32(
259257 let (b, c) = b.as_cell()?;
260258 let b = b.as_atom()?;
261259
262− hax(
263− ctx,
264− b.clone(),
265− tar(ctx, subj.clone(), c)?,
266− tar(ctx, subj, d)?,
267− )
260+ hax(ctx, b.clone(), tar(ctx, subj, &c)?, tar(ctx, subj, &d)?)
268261 }
269262 11 => {
270263 let (b, d) = formula.as_cell()?;
271264 // println!("{b}");
272265 match (*b).clone() {
273− Noun::Atom(_) => tar(ctx, subj, d),
266+ Noun::Atom(_) => tar(ctx, subj, &d),
274267 Noun::Cell { q: c, .. } => tar_u32(
275268 ctx,
276− cell(tar(ctx, subj.clone(), c)?, tar(ctx, subj, d)?),
269+ &cell(tar(ctx, subj, &c)?, tar(ctx, subj, &d)?),
277270 0,
278271 ctx.nouns.three.clone(),
279272 ),
@@ -283,10 +276,10 @@ fn tar_u32(
283276 }
284277}
285278
286−pub fn tar(ctx: &InterpreterContext, subj: Rc<Noun>, formula: Rc<Noun>) -> Option<Rc<Noun>> {
279+pub fn tar(ctx: &InterpreterContext, subj: &Noun, formula: &Noun) -> Option<Rc<Noun>> {
287280 let (op, formula) = formula.as_cell()?;
288281 match *op {
289− Noun::Cell { .. } => Some(cell(tar(ctx, subj.clone(), op)?, tar(ctx, subj, formula)?)),
282+ Noun::Cell { .. } => Some(cell(tar(ctx, subj, &op)?, tar(ctx, subj, &formula)?)),
290283 Noun::Atom(ref op) => {
291284 let mut op_iter = op.iter_u32_digits();
292285 let op = match op_iter.len() {
@@ -295,7 +288,7 @@ pub fn tar(ctx: &InterpreterContext, subj: Rc<Noun>, formula: Rc<Noun>) -> Optio
295288 _ => None,
296289 };
297290 let op = op?;
298− stacker::maybe_grow(32 * 1024, 1024 * 1024, || tar_u32(ctx, subj, op, formula))
291+ stacker::maybe_grow(32 * 1024, 1024 * 1024, || tar_u32(ctx, &subj, op, formula))
299292 }
300293 }
301294}
@@ -303,8 +296,8 @@ pub fn tar(ctx: &InterpreterContext, subj: Rc<Noun>, formula: Rc<Noun>) -> Optio
303296pub fn eval_gate(ctx: &InterpreterContext, gate: Rc<Noun>) -> Option<Rc<Noun>> {
304297 tar(
305298 ctx,
306− gate,
307− cell(
299+ &gate,
300+ &cell(
308301 Rc::new(Noun::Atom(BigUint::new(vec![9]))),
309302 cell(
310303 ctx.nouns.two.clone(),