on master help sign in
spun
commit3a3913b06eff6f6294a84857bfc2bc2ecd6fd708 authoriko <mail@iko.soy> dateSat 24 Aug 2024, 08:09 (2 years ago) parentc889775
1 file changed+16
nock/src/jets.rs+16
nock/src/jets.rs+16
@@ -56,6 +56,7 @@ pub fn generate_jets() -> Jets {
5656 (290837622185731774795798043954046795930, SNOC),
5757 (255402796382159268271460433298209603428, SORT),
5858 (10111398404342329752608067595798409804, SPIN),
59+ (209194119090564757355985847956576215234, SPUN),
5960 ])
6061}
6162
@@ -495,3 +496,18 @@ static SPIN: Jet = |ctx, n| {
495496
496497 cell(Noun::list_refs(res.iter().cloned()), acc)
497498};
499+
500+static SPUN: Jet = |ctx, n| {
501+ let (list, gate) = n.as_cell().unwrap();
502+
503+ let mut res = Vec::new();
504+ let mut acc = gate.clone().gate_sample().unwrap().as_cell().unwrap().1;
505+
506+ for n in list.list_iter() {
507+ let (el, new_acc) = slam(ctx, gate.clone(), cell(n, acc)).as_cell().unwrap();
508+ acc = new_acc;
509+ res.push(el);
510+ }
511+
512+ cell(Noun::list_refs(res.iter().cloned()), acc)
513+};