on master help sign in
warnings
49021deiko
nock/src/interpreter.rs+1−1
@@ -114,7 +114,7 @@ fn fas_u32(addr: u32, noun: &Noun) -> Option<Rc<Noun>> {
114 match addr {
114 match addr {
115 0 => None,
115 0 => None,
116 1 => Some(Rc::new(noun.clone())),
116 1 => Some(Rc::new(noun.clone())),
117− n => match noun.borrow() {
117+ n => match noun {
118 Noun::Atom(_) => None,
118 Noun::Atom(_) => None,
119 Noun::Cell { p, q, .. } => match n {
119 Noun::Cell { p, q, .. } => match n {
120 2 => Some(p.clone()),
120 2 => Some(p.clone()),
nock/src/jets.rs+5−6
@@ -3,13 +3,12 @@ use murmur3::murmur3_32;
3use num_integer::Integer;
3use num_integer::Integer;
4use std::{
4use std::{
5 collections::BTreeMap,
5 collections::BTreeMap,
6− io::Read,
7 iter::{once, repeat_n, zip},
6 iter::{once, repeat_n, zip},
8 rc::Rc,
7 rc::Rc,
9};
8};
10
9
11use crate::{
10use crate::{
12− interpreter::{eval_gate, slam, InterpreterContext},
11+ interpreter::{slam, InterpreterContext},
13 noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
12 noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
14};
13};
15
14
@@ -336,7 +335,7 @@ static INTO: Jet = |_ctx, n| {
336 .chain(once(c))
335 .chain(once(c))
337 .collect::<Vec<_>>()
336 .collect::<Vec<_>>()
338 .iter()
337 .iter()
339− .map(|x| x.clone()),
338+ .cloned(),
340 )),
339 )),
341 }
340 }
342};
341};
@@ -433,7 +432,7 @@ static SCAG: Jet = |_ctx, n| {
433 .take(a.as_u32().unwrap() as usize)
432 .take(a.as_u32().unwrap() as usize)
434 .collect::<Vec<_>>()
433 .collect::<Vec<_>>()
435 .iter()
434 .iter()
436− .map(|x| x.clone()),
435+ .cloned(),
437 ))
436 ))
438};
437};
439
438
@@ -444,8 +443,8 @@ static SKID: Jet = |ctx, n| {
444 let (ys, ns): (Vec<_>, _) = slammed_n.iter().partition(|(l, _)| l.is_y());
443 let (ys, ns): (Vec<_>, _) = slammed_n.iter().partition(|(l, _)| l.is_y());
445
444
446 Some(cell(
445 Some(cell(
447− &Noun::list_refs(ys.iter().map(|(_, x)| x.clone())),
446+ &Noun::list_refs(ys.iter().map(|(_, x)| *x)),
448− &Noun::list_refs(ns.iter().map(|(_, x)| x.clone())),
447+ &Noun::list_refs(ns.iter().map(|(_, x)| *x)),
449 ))
448 ))
450};
449};
451
450
nock/src/main.rs+3−6
@@ -1,18 +1,15 @@
1−use bitvec::ptr::read_unaligned;
2use clap::{command, error::Result, Parser, Subcommand};
1use clap::{command, error::Result, Parser, Subcommand};
2+use nock::interpreter::eval_gate;
3use nock::{
3use nock::{
4 cue::cue_bytes,
4 cue::cue_bytes,
5− interpreter::{self, eval_gate, generate_interpreter_context, slam},
5+ interpreter::{generate_interpreter_context, slam},
6 jam::jam_to_bytes,
6 jam::jam_to_bytes,
7 noun::{cell, Atom, Noun},
7 noun::{cell, Atom, Noun},
8};
8};
9use spinoff::Spinner;
9use spinoff::Spinner;
10use std::{
10use std::{
11− borrow::Borrow,
12 fs::File,
11 fs::File,
13− io::{self, stdin, stdout, Read, Write},
12+ io::{stdin, stdout, Read, Write},
14− os::unix::fs::FileExt,
15− panic::catch_unwind,
16 path::PathBuf,
13 path::PathBuf,
17 process::exit,
14 process::exit,
18 rc::Rc,
15 rc::Rc,
nock/src/noun.rs−2
@@ -4,8 +4,6 @@ use num_bigint::BigUint;
4use std::fmt;
4use std::fmt;
5use xxhash_rust::xxh3::xxh3_128;
5use xxhash_rust::xxh3::xxh3_128;
6
6
7−use crate::interpreter::InterpreterContext;
8−
9pub type Atom = BigUint;
7pub type Atom = BigUint;
10
8
11pub type Hash = u128;
9pub type Hash = u128;