Skip to content

Commit

Permalink
Merge pull request #1193 from andrew-johnson-4/generic-iter
Browse files Browse the repository at this point in the history
Generic iter
andrew-johnson-4 authored Jan 28, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents e6828d7 + 71f19a9 commit 2879858
Showing 4 changed files with 22,946 additions and 21,833 deletions.
44,758 changes: 22,931 additions & 21,827 deletions BOOTSTRAP/cli.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_mountain"
version = "1.20.52"
version = "1.20.53"
authors = ["Andrew <andrew@subarctic.org>"]
license = "MIT"
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)"
9 changes: 4 additions & 5 deletions PLATFORM/C/LIB/common-macros.lm
Original file line number Diff line number Diff line change
@@ -33,12 +33,11 @@ macro ( ('while cond body) )

macro ( ('for-each (item 'in iter) loop) ) (
(let (uuid iter-term) iter)
(while (non-zero (uuid iter-term)) (match (uuid iter-term) (
(let (uuid continue-iter) true)
(while (uuid continue-iter) (match (.next(&(uuid iter-term))) (
()
( (LCons( item (uuid iter-rst) )) (
loop
(set (uuid iter-term) (uuid iter-rst))
))
( (Some( item )) (loop ()) )
( None (set (uuid continue-iter) false) )
)))
);

10 changes: 10 additions & 0 deletions PLATFORM/C/LIB/list.lsts
Original file line number Diff line number Diff line change
@@ -35,3 +35,13 @@ let .unique(ls: List<x>): List<x> = (
};
rs
);

let .next(ls: Array<List<x>,?>): Maybe<x> = (
match open(ls) {
[i.. rst] => (
ls[0_u64] = rst;
Some(i)
);
[] => (None :: Maybe<x>);
};
);

0 comments on commit 2879858

Please sign in to comment.