First pass at a scheme backend
Some checks failed
Publish Playground / build (push) Has been cancelled
Publish Playground / deploy (push) Has been cancelled

This commit is contained in:
2026-03-16 17:03:33 -07:00
parent 92ced8dcd2
commit fe96f46534
23 changed files with 586 additions and 107 deletions

View File

@@ -9,8 +9,8 @@ record List1 a where
head1 : a
tail1 : List a
split1 : String String List1 String
split1 str by = case split str by of
splitBy1 : String Char List1 String
splitBy1 str by = case splitBy str by of
Nil => str ::: Nil
x :: xs => x ::: xs
@@ -22,6 +22,6 @@ unsnoc {a} (x ::: xs) = go x xs
go x (y :: ys) = let (as, a) = go y ys in (x :: as, a)
splitFileName : String String × String
splitFileName fn = case split1 fn "." of
splitFileName fn = case splitBy1 fn '.' of
part ::: Nil => (part, "")
xs => mapFst (joinBy ".") $ unsnoc xs

View File

@@ -9,6 +9,13 @@ snoclen {a} xs = go xs Z
go Lin acc = acc
go (xs :< x) acc = go xs (S acc)
snoclen' : a. SnocList a Int
snoclen' {a} xs = go xs 0
where
go : SnocList a Int Int
go Lin acc = acc
go (xs :< x) acc = go xs (1 + acc)
snocelem : a. {{Eq a}} a SnocList a Bool
snocelem a Lin = False
snocelem a (xs :< x) = if a == x then True else snocelem a xs