on master help sign in
murn
32dbe2diko
nock/src/jets.rs+13
@@ -40,6 +40,7 @@ pub fn generate_jets() -> Jets {
40 (211253539934007667533839299235896640130, LENT),
40 (211253539934007667533839299235896640130, LENT),
41 (104838119266193725126177792605193739824, LEVY),
41 (104838119266193725126177792605193739824, LEVY),
42 (136665047491594821996133547576675424469, LIEN),
42 (136665047491594821996133547576675424469, LIEN),
43+ (134383540064775397895881415210519251023, MURN),
43 ])
44 ])
44}
45}
45
46
@@ -311,3 +312,15 @@ static LIEN: Jet = |ctx, n| {
311 ctx.nouns.n.clone()
312 ctx.nouns.n.clone()
312 }
313 }
313};
314};
315+
316+static MURN: Jet = |ctx, n| {
317+ let (a, b) = n.as_cell().unwrap();
318+
319+ Noun::list_refs(
320+ a.list_iter()
321+ .filter_map(|n| call_gate(ctx, b.clone(), n).as_unit())
322+ .collect::<Vec<_>>()
323+ .iter()
324+ .map(|x| x.clone()),
325+ )
326+};
nock/src/noun.rs+9
@@ -83,6 +83,15 @@ impl Noun {
83 NounListIterator { noun: self.clone() }
83 NounListIterator { noun: self.clone() }
84 }
84 }
85
85
86+ /// panics if malformed
87+ pub fn as_unit(self: &Self) -> Option<Rc<Self>> {
88+ if self.is_sig() {
89+ Option::None
90+ } else {
91+ Option::Some(self.as_cell().unwrap().1)
92+ }
93+ }
94+
86 pub fn hash(self: &Self) -> Hash {
95 pub fn hash(self: &Self) -> Hash {
87 match self {
96 match self {
88 Noun::Cell { hash, .. } => *hash,
97 Noun::Cell { hash, .. } => *hash,