From ddeac1d774556961e4d5d7ba1c9a58a7e49c1085 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Thu, 5 Oct 2023 16:25:31 -0400 Subject: [PATCH 1/6] jets: add `dor`, `mor`, `gor` --- rust/ares/src/jets.rs | 6 ++ rust/ares/src/jets/math.rs | 23 ++++++ rust/ares/src/jets/order.rs | 151 ++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 rust/ares/src/jets/order.rs diff --git a/rust/ares/src/jets.rs b/rust/ares/src/jets.rs index 0a185d5e..f7fa0d3c 100644 --- a/rust/ares/src/jets.rs +++ b/rust/ares/src/jets.rs @@ -3,6 +3,7 @@ pub mod form; pub mod hash; pub mod math; pub mod nock; +pub mod order; pub mod text; pub mod tree; @@ -11,6 +12,7 @@ use crate::jets::form::*; use crate::jets::hash::*; use crate::jets::math::*; use crate::jets::nock::*; +use crate::jets::order::*; use crate::jets::text::*; use crate::jets::tree::*; use crate::mem::NockStack; @@ -87,6 +89,10 @@ pub fn get_jet(jet_name: Noun) -> Option { tas!(b"scow") => Some(jet_scow), // tas!(b"mink") => Some(jet_mink), + // + tas!(b"dor") => Some(jet_dor), + tas!(b"gor") => Some(jet_gor), + tas!(b"mor") => Some(jet_mor), _ => { // eprintln!("Unknown jet: {:?}", jet_name); None diff --git a/rust/ares/src/jets/math.rs b/rust/ares/src/jets/math.rs index 3a36353b..5e853be1 100644 --- a/rust/ares/src/jets/math.rs +++ b/rust/ares/src/jets/math.rs @@ -303,6 +303,29 @@ pub fn jet_sub( Ok(sub(stack, a, b)?.as_noun()) } +pub mod util { + use crate::noun::{Atom, Noun, YES, NO}; + use crate::mem::NockStack; + + pub fn lth(stack: &mut NockStack, a: Atom, b: Atom) -> Noun { + if let (Ok(a), Ok(b)) = (a.as_direct(), b.as_direct()) { + if a.data() < b.data() { + YES + } else { + NO + } + } else if a.bit_size() < b.bit_size() { + YES + } else if a.bit_size() > b.bit_size() { + NO + } else if a.as_ubig(stack) < b.as_ubig(stack) { + YES + } else { + NO + } + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/rust/ares/src/jets/order.rs b/rust/ares/src/jets/order.rs new file mode 100644 index 00000000..7d095704 --- /dev/null +++ b/rust/ares/src/jets/order.rs @@ -0,0 +1,151 @@ +use crate::jets::util::slot; +/** Text processing jets + */ +use crate::jets; +use crate::jets::order::util::dor; +use crate::mem::NockStack; +use crate::mug::mug; +use crate::newt::Newt; +use crate::noun::{Noun, NO, YES}; + +crate::gdb!(); + +pub fn jet_mor( + stack: &mut NockStack, + _newt: &mut Option<&mut Newt>, + subject: Noun, +) -> jets::Result { + let sam = slot(subject, 6)?; + let a = slot(sam, 2)?; + let b = slot(sam, 3)?; + + let c = mug(stack, a); + let d = mug(stack, b); + + let e = mug(stack, c.as_noun()); + let f = mug(stack, d.as_noun()); + + if e.data() == f.data() { + dor(stack, a, b) + } else { + if e.data() < f.data() { + Ok(YES) + } else { + Ok(NO) + } + } +} + +pub fn jet_gor( + stack: &mut NockStack, + _newt: &mut Option<&mut Newt>, + subject: Noun, +) -> jets::Result { + let sam = slot(subject, 6)?; + let a = slot(sam, 2)?; + let b = slot(sam, 3)?; + + let c = mug(stack, a); + let d = mug(stack, b); + + if c.data() == d.data() { + dor(stack, a, b) + } else { + if c.data() < d.data() { + Ok(YES) + } else { + Ok(NO) + } + } +} + +pub fn jet_dor( + stack: &mut NockStack, + _newt: &mut Option<&mut Newt>, + subject: Noun, +) -> jets::Result { + let sam = slot(subject, 6)?; + let a = slot(sam, 2)?; + let b = slot(sam, 3)?; + + dor(stack, a, b) +} + +pub mod util { + use crate::jets::util::slot; + use crate::jets::math::util::lth; + use crate::jets::Result; + use crate::mem::NockStack; + use crate::noun::{Noun, YES, NO}; + + pub fn dor(stack: &mut NockStack, a: Noun, b: Noun) -> Result { + if unsafe { a.raw_equals(b) } { + Ok(YES) + } else { + if a.is_atom() { + if b.is_atom() { + Ok(lth(stack, a.as_atom()?, b.as_atom()?)) + } else { + Ok(YES) + } + } else { + if b.is_atom() { + Ok(NO) + } else { + let a = slot(a, 2).unwrap(); + let b = slot(b, 2).unwrap(); + if unsafe { a.raw_equals(b) } { + Ok(dor(stack, slot(a, 3)?, slot(b, 3)?)?) + } else { + Ok(dor(stack, slot(a, 2)?, slot(b, 2)?)?) + } + } + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use ibig::ubig; + use crate::jets::util::test::{A, assert_jet, init_stack}; + use crate::noun::{D, T}; + + #[test] + fn test_dor() { + let s = &mut init_stack(); + let sam = T(s, &[D(1), D(1)]); + assert_jet(s, jet_dor, sam, YES); + + let a = A(s, &ubig!(_0x3fffffffffffffff)); + let sam = T(s, &[a, D(1)]); + assert_jet(s, jet_dor, sam, NO); + + let a = A(s, &ubig!(_0x3fffffffffffffff)); + let sam = T(s, &[a, a]); + assert_jet(s, jet_dor, sam, YES); + } + + #[test] + fn test_gor() { + let s = &mut init_stack(); + let sam = T(s, &[D(1), D(1)]); + assert_jet(s, jet_gor, sam, YES); + + let a = A(s, &ubig!(_0x3fffffffffffffff)); + let sam = T(s, &[a, a]); + assert_jet(s, jet_gor, sam, YES); + } + + #[test] + fn test_mor() { + let s = &mut init_stack(); + let sam = T(s, &[D(1), D(1)]); + assert_jet(s, jet_mor, sam, YES); + + let a = A(s, &ubig!(_0x3fffffffffffffff)); + let sam = T(s, &[a, a]); + assert_jet(s, jet_mor, sam, YES); + } +} From 995ae4c9034e3d37a6323ad92a73bc1f3b35721d Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Fri, 6 Oct 2023 08:18:16 -0400 Subject: [PATCH 2/6] jets: fix `dor` --- rust/ares/src/jets/order.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rust/ares/src/jets/order.rs b/rust/ares/src/jets/order.rs index 7d095704..680b9563 100644 --- a/rust/ares/src/jets/order.rs +++ b/rust/ares/src/jets/order.rs @@ -92,12 +92,14 @@ pub mod util { if b.is_atom() { Ok(NO) } else { - let a = slot(a, 2).unwrap(); - let b = slot(b, 2).unwrap(); - if unsafe { a.raw_equals(b) } { - Ok(dor(stack, slot(a, 3)?, slot(b, 3)?)?) + let a_head = slot(a, 2)?; + let b_head = slot(b, 2)?; + let a_tail = slot(a, 3)?; + let b_tail = slot(b, 3)?; + if unsafe { a_head.raw_equals(b_head) } { + Ok(dor(stack, a_tail, b_tail)?) } else { - Ok(dor(stack, slot(a, 2)?, slot(b, 2)?)?) + Ok(dor(stack, a_head, b_head)?) } } } From afbd650751ee389800a688427de3c419bab791f7 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Mon, 9 Oct 2023 09:45:54 -0400 Subject: [PATCH 3/6] jets: address @ashelkovnykov's comments #1 --- rust/ares/src/jets/math.rs | 33 ++++++++++----------------------- rust/ares/src/jets/order.rs | 13 ++++++------- rust/ares/src/jets/text.rs | 2 +- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/rust/ares/src/jets/math.rs b/rust/ares/src/jets/math.rs index 5e853be1..4fd22d83 100644 --- a/rust/ares/src/jets/math.rs +++ b/rust/ares/src/jets/math.rs @@ -224,21 +224,7 @@ pub fn jet_lth( let a = slot(arg, 2)?.as_atom()?; let b = slot(arg, 3)?.as_atom()?; - Ok(if let (Ok(a), Ok(b)) = (a.as_direct(), b.as_direct()) { - if a.data() < b.data() { - YES - } else { - NO - } - } else if a.bit_size() < b.bit_size() { - YES - } else if a.bit_size() > b.bit_size() { - NO - } else if a.as_ubig(stack) < b.as_ubig(stack) { - YES - } else { - NO - }) + util::lth(stack, a, b) } pub fn jet_mod( @@ -304,24 +290,25 @@ pub fn jet_sub( } pub mod util { - use crate::noun::{Atom, Noun, YES, NO}; + use crate::jets::Result; + use crate::noun::{Atom, YES, NO}; use crate::mem::NockStack; - pub fn lth(stack: &mut NockStack, a: Atom, b: Atom) -> Noun { + pub fn lth(stack: &mut NockStack, a: Atom, b: Atom) -> Result { if let (Ok(a), Ok(b)) = (a.as_direct(), b.as_direct()) { if a.data() < b.data() { - YES + Ok(YES) } else { - NO + Ok(NO) } } else if a.bit_size() < b.bit_size() { - YES + Ok(YES) } else if a.bit_size() > b.bit_size() { - NO + Ok(NO) } else if a.as_ubig(stack) < b.as_ubig(stack) { - YES + Ok(YES) } else { - NO + Ok(NO) } } } diff --git a/rust/ares/src/jets/order.rs b/rust/ares/src/jets/order.rs index 680b9563..1a42c885 100644 --- a/rust/ares/src/jets/order.rs +++ b/rust/ares/src/jets/order.rs @@ -1,8 +1,7 @@ -use crate::jets::util::slot; -/** Text processing jets +/** Ordering jets */ use crate::jets; -use crate::jets::order::util::dor; +use crate::jets::util::slot; use crate::mem::NockStack; use crate::mug::mug; use crate::newt::Newt; @@ -26,7 +25,7 @@ pub fn jet_mor( let f = mug(stack, d.as_noun()); if e.data() == f.data() { - dor(stack, a, b) + util::dor(stack, a, b) } else { if e.data() < f.data() { Ok(YES) @@ -49,7 +48,7 @@ pub fn jet_gor( let d = mug(stack, b); if c.data() == d.data() { - dor(stack, a, b) + util::dor(stack, a, b) } else { if c.data() < d.data() { Ok(YES) @@ -68,7 +67,7 @@ pub fn jet_dor( let a = slot(sam, 2)?; let b = slot(sam, 3)?; - dor(stack, a, b) + util::dor(stack, a, b) } pub mod util { @@ -84,7 +83,7 @@ pub mod util { } else { if a.is_atom() { if b.is_atom() { - Ok(lth(stack, a.as_atom()?, b.as_atom()?)) + lth(stack, a.as_atom()?, b.as_atom()?) } else { Ok(YES) } diff --git a/rust/ares/src/jets/text.rs b/rust/ares/src/jets/text.rs index 486c87ee..62d702d6 100644 --- a/rust/ares/src/jets/text.rs +++ b/rust/ares/src/jets/text.rs @@ -1,7 +1,7 @@ -use crate::jets::util::slot; /** Text processing jets */ use crate::jets::Result; +use crate::jets::util::slot; use crate::mem::NockStack; use crate::newt::Newt; use crate::noun::{Noun, D}; From 6ebc6a2ffae75529fad046ea07569c51ae7ed73e Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Mon, 9 Oct 2023 09:48:25 -0400 Subject: [PATCH 4/6] jets: rename `order` to `sort` --- rust/ares/src/jets.rs | 4 ++-- rust/ares/src/jets/{order.rs => sort.rs} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename rust/ares/src/jets/{order.rs => sort.rs} (99%) diff --git a/rust/ares/src/jets.rs b/rust/ares/src/jets.rs index f7fa0d3c..b058ed52 100644 --- a/rust/ares/src/jets.rs +++ b/rust/ares/src/jets.rs @@ -3,7 +3,7 @@ pub mod form; pub mod hash; pub mod math; pub mod nock; -pub mod order; +pub mod sort; pub mod text; pub mod tree; @@ -12,7 +12,7 @@ use crate::jets::form::*; use crate::jets::hash::*; use crate::jets::math::*; use crate::jets::nock::*; -use crate::jets::order::*; +use crate::jets::sort::*; use crate::jets::text::*; use crate::jets::tree::*; use crate::mem::NockStack; diff --git a/rust/ares/src/jets/order.rs b/rust/ares/src/jets/sort.rs similarity index 99% rename from rust/ares/src/jets/order.rs rename to rust/ares/src/jets/sort.rs index 1a42c885..44fd84ae 100644 --- a/rust/ares/src/jets/order.rs +++ b/rust/ares/src/jets/sort.rs @@ -1,4 +1,4 @@ -/** Ordering jets +/** Sorting jets */ use crate::jets; use crate::jets::util::slot; From cceba78d94d3dee280ca0b7f939b58734e7b8de3 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Thu, 12 Oct 2023 07:32:31 -0400 Subject: [PATCH 5/6] jets: cleanup `lth` and `dor` --- rust/ares/src/jets/math.rs | 27 ++++++++++++----------- rust/ares/src/jets/sort.rs | 45 ++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/rust/ares/src/jets/math.rs b/rust/ares/src/jets/math.rs index 4fd22d83..fa27142e 100644 --- a/rust/ares/src/jets/math.rs +++ b/rust/ares/src/jets/math.rs @@ -216,7 +216,7 @@ pub fn jet_lte( } pub fn jet_lth( - stack: &mut NockStack, + _stack: &mut NockStack, _newt: &mut Option<&mut Newt>, subject: Noun, ) -> jets::Result { @@ -224,7 +224,7 @@ pub fn jet_lth( let a = slot(arg, 2)?.as_atom()?; let b = slot(arg, 3)?.as_atom()?; - util::lth(stack, a, b) + Ok(util::lth(a, b)) } pub fn jet_mod( @@ -290,25 +290,26 @@ pub fn jet_sub( } pub mod util { - use crate::jets::Result; - use crate::noun::{Atom, YES, NO}; - use crate::mem::NockStack; + use crate::jets::util::test::init_stack; + use crate::noun::{Atom, Noun, YES, NO}; + + pub fn lth(a: Atom, b: Atom) -> Noun { + let s = &mut init_stack(); - pub fn lth(stack: &mut NockStack, a: Atom, b: Atom) -> Result { if let (Ok(a), Ok(b)) = (a.as_direct(), b.as_direct()) { if a.data() < b.data() { - Ok(YES) + YES } else { - Ok(NO) + NO } } else if a.bit_size() < b.bit_size() { - Ok(YES) + YES } else if a.bit_size() > b.bit_size() { - Ok(NO) - } else if a.as_ubig(stack) < b.as_ubig(stack) { - Ok(YES) + NO + } else if a.as_ubig(s) < b.as_ubig(s) { + YES } else { - Ok(NO) + NO } } } diff --git a/rust/ares/src/jets/sort.rs b/rust/ares/src/jets/sort.rs index 44fd84ae..6a59d710 100644 --- a/rust/ares/src/jets/sort.rs +++ b/rust/ares/src/jets/sort.rs @@ -25,7 +25,7 @@ pub fn jet_mor( let f = mug(stack, d.as_noun()); if e.data() == f.data() { - util::dor(stack, a, b) + Ok(util::dor(a, b)) } else { if e.data() < f.data() { Ok(YES) @@ -48,7 +48,7 @@ pub fn jet_gor( let d = mug(stack, b); if c.data() == d.data() { - util::dor(stack, a, b) + Ok(util::dor(a, b)) } else { if c.data() < d.data() { Ok(YES) @@ -59,7 +59,7 @@ pub fn jet_gor( } pub fn jet_dor( - stack: &mut NockStack, + _stack: &mut NockStack, _newt: &mut Option<&mut Newt>, subject: Noun, ) -> jets::Result { @@ -67,38 +67,35 @@ pub fn jet_dor( let a = slot(sam, 2)?; let b = slot(sam, 3)?; - util::dor(stack, a, b) + Ok(util::dor(a, b)) } pub mod util { + use either::{Left, Right}; use crate::jets::util::slot; use crate::jets::math::util::lth; - use crate::jets::Result; - use crate::mem::NockStack; use crate::noun::{Noun, YES, NO}; - pub fn dor(stack: &mut NockStack, a: Noun, b: Noun) -> Result { + pub fn dor(a: Noun, b: Noun) -> Noun { if unsafe { a.raw_equals(b) } { - Ok(YES) + YES } else { - if a.is_atom() { - if b.is_atom() { - lth(stack, a.as_atom()?, b.as_atom()?) - } else { - Ok(YES) - } - } else { - if b.is_atom() { - Ok(NO) - } else { - let a_head = slot(a, 2)?; - let b_head = slot(b, 2)?; - let a_tail = slot(a, 3)?; - let b_tail = slot(b, 3)?; + match (a.as_either_atom_cell(), b.as_either_atom_cell()) { + (Left(atom_a), Left(atom_b)) => lth(atom_a, atom_b), + (Left(_), Right(_)) => YES, + (Right(_), Left(_)) => NO, + (Right(cell_a), Right(cell_b)) => { + let a_head = match slot(cell_a.as_noun(), 2) { + Ok(n) => n, + Err(_) => return NO, + }; + let b_head = slot(cell_b.as_noun(), 2).unwrap(); + let a_tail = slot(cell_a.as_noun(), 3).unwrap(); + let b_tail = slot(cell_b.as_noun(), 3).unwrap(); if unsafe { a_head.raw_equals(b_head) } { - Ok(dor(stack, a_tail, b_tail)?) + dor(a_tail, b_tail) } else { - Ok(dor(stack, a_head, b_head)?) + dor(a_head, b_head) } } } From 086822f22ccd4a7f30204950682f11710d427602 Mon Sep 17 00:00:00 2001 From: Alex Shelkovnykov Date: Wed, 18 Oct 2023 15:40:34 -0600 Subject: [PATCH 6/6] Fix merge conflicts --- rust/ares/src/jets.rs | 8 ++--- rust/ares/src/jets/hot.rs | 4 +++ rust/ares/src/jets/math.rs | 8 ++--- rust/ares/src/jets/sort.rs | 60 ++++++++++++++------------------------ rust/ares/src/jets/text.rs | 3 -- 5 files changed, 32 insertions(+), 51 deletions(-) diff --git a/rust/ares/src/jets.rs b/rust/ares/src/jets.rs index b45081fc..c5f90dab 100644 --- a/rust/ares/src/jets.rs +++ b/rust/ares/src/jets.rs @@ -93,13 +93,13 @@ pub fn get_jet(jet_name: Noun) -> Option { // tas!(b"mug") => Some(jet_mug), // - tas!(b"scow") => Some(jet_scow), - // - tas!(b"mink") => Some(jet_mink), - // tas!(b"dor") => Some(jet_dor), tas!(b"gor") => Some(jet_gor), tas!(b"mor") => Some(jet_mor), + // + tas!(b"scow") => Some(jet_scow), + // + tas!(b"mink") => Some(jet_mink), _ => { // eprintln!("Unknown jet: {:?}", jet_name); None diff --git a/rust/ares/src/jets/hot.rs b/rust/ares/src/jets/hot.rs index 78ca9edc..b808ad9a 100644 --- a/rust/ares/src/jets/hot.rs +++ b/rust/ares/src/jets/hot.rs @@ -45,6 +45,10 @@ const HOT_STATE: &[(&[Either], u64, Jet)] = &[ // (&[A_50, Left(tas!(b"mug"))], 1, jet_mug), // + (&[A_50, Left(tas!(b"dor"))], 1, jet_dor), + (&[A_50, Left(tas!(b"gor"))], 1, jet_gor), + (&[A_50, Left(tas!(b"mor"))], 1, jet_mor), + // (&[A_50, Left(tas!(b"scow"))], 1, jet_scow), // (&[A_50, Left(tas!(b"mink"))], 1, jet_mink), diff --git a/rust/ares/src/jets/math.rs b/rust/ares/src/jets/math.rs index 201eb3f1..5d075ad9 100644 --- a/rust/ares/src/jets/math.rs +++ b/rust/ares/src/jets/math.rs @@ -190,11 +190,7 @@ pub fn jet_lte(context: &mut Context, subject: Noun) -> Result { }) } -pub fn jet_lth( - _stack: &mut NockStack, - _newt: &mut Option<&mut Newt>, - subject: Noun, -) -> jets::Result { +pub fn jet_lth(_context: &mut Context, subject: Noun) -> Result { let arg = slot(subject, 6)?; let a = slot(arg, 2)?.as_atom()?; let b = slot(arg, 3)?.as_atom()?; @@ -256,7 +252,7 @@ pub fn jet_sub(context: &mut Context, subject: Noun) -> Result { pub mod util { use crate::jets::util::test::init_stack; - use crate::noun::{Atom, Noun, YES, NO}; + use crate::noun::{Atom, Noun, NO, YES}; pub fn lth(a: Atom, b: Atom) -> Noun { let s = &mut init_stack(); diff --git a/rust/ares/src/jets/sort.rs b/rust/ares/src/jets/sort.rs index 6a59d710..65b105a0 100644 --- a/rust/ares/src/jets/sort.rs +++ b/rust/ares/src/jets/sort.rs @@ -1,19 +1,17 @@ /** Sorting jets */ +use crate::interpreter::Context; use crate::jets; use crate::jets::util::slot; -use crate::mem::NockStack; use crate::mug::mug; -use crate::newt::Newt; use crate::noun::{Noun, NO, YES}; +use std::cmp::Ordering; crate::gdb!(); -pub fn jet_mor( - stack: &mut NockStack, - _newt: &mut Option<&mut Newt>, - subject: Noun, -) -> jets::Result { +pub fn jet_mor(context: &mut Context, subject: Noun) -> jets::Result { + let stack = &mut context.stack; + let sam = slot(subject, 6)?; let a = slot(sam, 2)?; let b = slot(sam, 3)?; @@ -24,22 +22,16 @@ pub fn jet_mor( let e = mug(stack, c.as_noun()); let f = mug(stack, d.as_noun()); - if e.data() == f.data() { - Ok(util::dor(a, b)) - } else { - if e.data() < f.data() { - Ok(YES) - } else { - Ok(NO) - } + match e.data().cmp(&f.data()) { + Ordering::Greater => Ok(NO), + Ordering::Less => Ok(YES), + Ordering::Equal => Ok(util::dor(a, b)), } } -pub fn jet_gor( - stack: &mut NockStack, - _newt: &mut Option<&mut Newt>, - subject: Noun, -) -> jets::Result { +pub fn jet_gor(context: &mut Context, subject: Noun) -> jets::Result { + let stack = &mut context.stack; + let sam = slot(subject, 6)?; let a = slot(sam, 2)?; let b = slot(sam, 3)?; @@ -47,22 +39,14 @@ pub fn jet_gor( let c = mug(stack, a); let d = mug(stack, b); - if c.data() == d.data() { - Ok(util::dor(a, b)) - } else { - if c.data() < d.data() { - Ok(YES) - } else { - Ok(NO) - } + match c.data().cmp(&d.data()) { + Ordering::Greater => Ok(NO), + Ordering::Less => Ok(YES), + Ordering::Equal => Ok(util::dor(a, b)), } } -pub fn jet_dor( - _stack: &mut NockStack, - _newt: &mut Option<&mut Newt>, - subject: Noun, -) -> jets::Result { +pub fn jet_dor(_context: &mut Context, subject: Noun) -> jets::Result { let sam = slot(subject, 6)?; let a = slot(sam, 2)?; let b = slot(sam, 3)?; @@ -71,10 +55,10 @@ pub fn jet_dor( } pub mod util { - use either::{Left, Right}; - use crate::jets::util::slot; use crate::jets::math::util::lth; - use crate::noun::{Noun, YES, NO}; + use crate::jets::util::slot; + use crate::noun::{Noun, NO, YES}; + use either::{Left, Right}; pub fn dor(a: Noun, b: Noun) -> Noun { if unsafe { a.raw_equals(b) } { @@ -106,9 +90,9 @@ pub mod util { #[cfg(test)] mod tests { use super::*; - use ibig::ubig; - use crate::jets::util::test::{A, assert_jet, init_stack}; + use crate::jets::util::test::{assert_jet, init_stack, A}; use crate::noun::{D, T}; + use ibig::ubig; #[test] fn test_dor() { diff --git a/rust/ares/src/jets/text.rs b/rust/ares/src/jets/text.rs index 65005051..c26fdf77 100644 --- a/rust/ares/src/jets/text.rs +++ b/rust/ares/src/jets/text.rs @@ -3,9 +3,6 @@ use crate::interpreter::Context; use crate::jets::util::slot; use crate::jets::Result; -use crate::jets::util::slot; -use crate::mem::NockStack; -use crate::newt::Newt; use crate::noun::{Noun, D}; crate::gdb!();