hoon, jets: add +cap

This commit is contained in:
Alex Shelkovnykov 2023-09-01 16:26:29 -06:00
parent 866f3dae3d
commit 5a2e4eec57
3 changed files with 1466 additions and 0 deletions

View File

@ -133,6 +133,20 @@
?: =(0 b) a
$(a (dec a), b (dec b))
::
:: Tree addressing
::
++ cap :: index in head or tail
~/ %cap
|= a=@
~> %sham.%cap
^- ?(%2 %3)
?- a
%2 %2
%3 %3
?(%0 %1) !!
* $(a (div a 2))
==
::
:: List logic
::
++ flop :: reverse

View File

@ -1,8 +1,10 @@
pub mod math;
pub mod mink;
pub mod tree;
use crate::jets::math::*;
use crate::jets::mink::*;
use crate::jets::tree::*;
use crate::mem::NockStack;
use crate::newt::Newt;
use crate::noun::{self, Noun, Slots};
@ -66,6 +68,9 @@ pub fn get_jet(jet_name: Noun) -> Option<Jet> {
tas!(b"met") => Some(jet_met),
tas!(b"mug") => Some(jet_mug),
tas!(b"rev") => Some(jet_rev),
//
tas!(b"cap") => Some(jet_cap),
//
tas!(b"mink") => Some(jet_mink),
_ => {
// eprintln!("Unknown jet: {:?}", jet_name);

1447
rust/ares/src/jets/tree.rs Normal file

File diff suppressed because it is too large Load Diff