on master help sign in
skid
ca3360eiko
nock/src/jets.rs+14
@@ -46,6 +46,7 @@ pub fn generate_jets() -> Jets {
46 (146282575960509029931248602154898675358, REEL),
46 (146282575960509029931248602154898675358, REEL),
47 (218516926094890651045754335042357820192, ROLL),
47 (218516926094890651045754335042357820192, ROLL),
48 (89970054366691388746503743197917964564, SCAG),
48 (89970054366691388746503743197917964564, SCAG),
49+ (68845187332605602565057027619381114427, SKID),
49 ])
50 ])
50}
51}
51
52
@@ -367,3 +368,16 @@ static SCAG: Jet = |_ctx, n| {
367 .map(|x| x.clone()),
368 .map(|x| x.clone()),
368 )
369 )
369};
370};
371+
372+static SKID: Jet = |ctx, n| {
373+ let (list, gate) = n.as_cell().unwrap();
374+
375+ let (ys, ns): (Vec<Rc<Noun>>, _) = list
376+ .list_iter()
377+ .partition(|n| slam(ctx, gate.clone(), n.clone()).is_y());
378+
379+ cell(
380+ Noun::list_refs(ys.iter().cloned()),
381+ Noun::list_refs(ns.iter().cloned()),
382+ )
383+};
nock/src/noun.rs+8
@@ -96,6 +96,14 @@ impl Noun {
96 }
96 }
97 }
97 }
98
98
99+ pub fn is_y(self: &Self) -> bool {
100+ self.is_sig()
101+ }
102+
103+ pub fn is_n(self: &Self) -> bool {
104+ !self.is_sig()
105+ }
106+
99 pub fn list_iter(self: Rc<Self>) -> NounListIterator {
107 pub fn list_iter(self: Rc<Self>) -> NounListIterator {
100 NounListIterator { noun: self.clone() }
108 NounListIterator { noun: self.clone() }
101 }
109 }