mirror of
https://github.com/urbit/ares.git
synced 2024-12-25 06:12:24 +03:00
cleanup
This commit is contained in:
parent
bdc9224995
commit
da6e8b2522
@ -6,10 +6,10 @@ pub mod bits;
|
|||||||
pub mod form;
|
pub mod form;
|
||||||
pub mod hash;
|
pub mod hash;
|
||||||
pub mod list;
|
pub mod list;
|
||||||
pub mod parse;
|
|
||||||
pub mod lute;
|
pub mod lute;
|
||||||
pub mod math;
|
pub mod math;
|
||||||
pub mod nock;
|
pub mod nock;
|
||||||
|
pub mod parse;
|
||||||
pub mod serial;
|
pub mod serial;
|
||||||
pub mod sort;
|
pub mod sort;
|
||||||
pub mod tree;
|
pub mod tree;
|
||||||
@ -21,10 +21,10 @@ use crate::jets::form::*;
|
|||||||
use crate::jets::hash::*;
|
use crate::jets::hash::*;
|
||||||
use crate::jets::hot::Hot;
|
use crate::jets::hot::Hot;
|
||||||
use crate::jets::list::*;
|
use crate::jets::list::*;
|
||||||
use crate::jets::parse::*;
|
|
||||||
use crate::jets::lute::*;
|
use crate::jets::lute::*;
|
||||||
use crate::jets::math::*;
|
use crate::jets::math::*;
|
||||||
use crate::jets::nock::*;
|
use crate::jets::nock::*;
|
||||||
|
use crate::jets::parse::*;
|
||||||
use crate::jets::serial::*;
|
use crate::jets::serial::*;
|
||||||
use crate::jets::sort::*;
|
use crate::jets::sort::*;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ use crate::jets::tree::*;
|
|||||||
use crate::jets::warm::Warm;
|
use crate::jets::warm::Warm;
|
||||||
use crate::mem::NockStack;
|
use crate::mem::NockStack;
|
||||||
use crate::newt::Newt;
|
use crate::newt::Newt;
|
||||||
use crate::noun::{self, Noun, Atom, Slots, D};
|
use crate::noun::{self, Noun, Slots, D};
|
||||||
use ares_macros::tas;
|
use ares_macros::tas;
|
||||||
|
|
||||||
crate::gdb!();
|
crate::gdb!();
|
||||||
@ -126,6 +126,9 @@ pub fn get_jet(jet_name: Noun) -> Option<Jet> {
|
|||||||
tas!(b"scow") => Some(jet_scow),
|
tas!(b"scow") => Some(jet_scow),
|
||||||
//
|
//
|
||||||
tas!(b"mink") => Some(jet_mink),
|
tas!(b"mink") => Some(jet_mink),
|
||||||
|
//
|
||||||
|
tas!(b"pose") => Some(jet_pose),
|
||||||
|
tas!(b"last") => Some(jet_last),
|
||||||
_ => {
|
_ => {
|
||||||
// eprintln!("Unknown jet: {:?}", jet_name);
|
// eprintln!("Unknown jet: {:?}", jet_name);
|
||||||
None
|
None
|
||||||
|
@ -2,11 +2,10 @@ use either::Either::{Left, Right};
|
|||||||
|
|
||||||
/** Parsing jets
|
/** Parsing jets
|
||||||
*/
|
*/
|
||||||
use crate::interpreter::{Context, interpret};
|
use crate::interpreter::Context;
|
||||||
use crate::jets::util::{slot, kick};
|
use crate::jets::util::{kick, slot};
|
||||||
use crate::jets::Result;
|
use crate::jets::Result;
|
||||||
use crate::noun::{Noun, D, T};
|
use crate::noun::{Noun, D, T};
|
||||||
use crate::jets::nock::util::slam_gate_fol;
|
|
||||||
|
|
||||||
crate::gdb!();
|
crate::gdb!();
|
||||||
|
|
||||||
@ -28,23 +27,24 @@ pub fn jet_pose(context: &mut Context, subject: Noun) -> Result {
|
|||||||
|
|
||||||
match vex.as_either_atom_cell() {
|
match vex.as_either_atom_cell() {
|
||||||
Left(_a) => {
|
Left(_a) => {
|
||||||
assert!(vex.raw_equals(D(0)));
|
assert!(unsafe { vex.raw_equals(D(0)) });
|
||||||
|
|
||||||
//let fol = slam_gate_fol(&mut context.stack);
|
//let fol = slam_gate_fol(&mut context.stack);
|
||||||
let roq = kick(context, sab, D(2))?;
|
let roq = kick(context, sab, D(2))?;
|
||||||
|
|
||||||
Ok(T(&mut context.stack,
|
Ok(T(
|
||||||
&[util::last(vex.as_cell()?.head(),
|
&mut context.stack,
|
||||||
roq.as_cell()?.head())?,
|
&[
|
||||||
roq.as_cell()?.tail()]))
|
util::last(vex.as_cell()?.head(), roq.as_cell()?.head())?,
|
||||||
},
|
roq.as_cell()?.tail(),
|
||||||
Right(_c) => {
|
],
|
||||||
Ok(vex)
|
))
|
||||||
}
|
}
|
||||||
|
Right(_c) => Ok(vex),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn jet_last(context: &mut Context, subject: Noun) -> Result {
|
pub fn jet_last(_context: &mut Context, subject: Noun) -> Result {
|
||||||
let sam = slot(subject, 6)?;
|
let sam = slot(subject, 6)?;
|
||||||
let zyc = slot(sam, 2)?;
|
let zyc = slot(sam, 2)?;
|
||||||
let naz = slot(sam, 3)?;
|
let naz = slot(sam, 3)?;
|
||||||
@ -53,12 +53,10 @@ pub fn jet_last(context: &mut Context, subject: Noun) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod util {
|
pub mod util {
|
||||||
use crate::interpreter::{Context, interpret};
|
|
||||||
use crate::jets::util::slot;
|
|
||||||
use crate::jets::Result;
|
use crate::jets::Result;
|
||||||
use crate::noun::{Noun, D};
|
use crate::noun::Noun;
|
||||||
|
|
||||||
pub fn last(zyc: Noun, naz:Noun) -> Result {
|
pub fn last(zyc: Noun, naz: Noun) -> Result {
|
||||||
let zyl = zyc.as_cell()?;
|
let zyl = zyc.as_cell()?;
|
||||||
let nal = naz.as_cell()?;
|
let nal = naz.as_cell()?;
|
||||||
|
|
||||||
@ -67,22 +65,22 @@ pub mod util {
|
|||||||
assert!(nal.head().is_direct());
|
assert!(nal.head().is_direct());
|
||||||
assert!(nal.tail().is_direct());
|
assert!(nal.tail().is_direct());
|
||||||
|
|
||||||
if zyl.head().raw_equals(nal.head()) {
|
unsafe {
|
||||||
if zyl.tail().as_direct().as_u64() > nal.tail().as_direct().as_u64() {
|
if zyl.head().raw_equals(nal.head()) {
|
||||||
Ok(zyc)
|
if zyl.tail().as_atom()?.as_u64()? > nal.tail().as_atom()?.as_u64()? {
|
||||||
|
Ok(zyc)
|
||||||
|
} else {
|
||||||
|
Ok(naz)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok(naz)
|
if zyl.head().as_atom()?.as_u64()? > nal.head().as_atom()?.as_u64()? {
|
||||||
}
|
Ok(zyc)
|
||||||
} else {
|
} else {
|
||||||
if zyl.head().as_direct().as_u64() > nal.head().as_direct().as_u64() {
|
Ok(naz)
|
||||||
Ok(zyc)
|
}
|
||||||
} else {
|
|
||||||
Ok(naz)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod test {
|
pub mod test {}
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user