-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #624 from andrew-johnson-4/implicit-tail
Implicit tail
- Loading branch information
Showing
45 changed files
with
28,676 additions
and
29,198 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lambda_mountain" | ||
version = "1.15.24" | ||
version = "1.15.25" | ||
authors = ["Andrew <[email protected]>"] | ||
license = "MIT" | ||
description = "Compiler Backend / Programming Language Scaffolding" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
|
||
type List<x> LEOF | (LCons( x , List<x>[] )); zero List<x> LEOF; | ||
|
||
cons := λ(: hd x)(: tl List<x>). (: (tail( | ||
cons := λ(: hd x)(: tl List<x>). (: ( | ||
(set tl (LCons( hd (close tl) ))) | ||
tl | ||
)) List<x>); | ||
) List<x>); | ||
|
||
+ := λ(: hd List<x>)(: tl List<x>). (: (tail( | ||
+ := λ(: hd List<x>)(: tl List<x>). (: ( | ||
(set hd (reverse hd)) | ||
(while (non-zero hd) (match hd ( | ||
() | ||
( (LCons( hdhd tlhd )) (tail( | ||
( (LCons( hdhd tlhd )) ( | ||
(set tl (cons( hdhd tl ))) | ||
(set hd tlhd) | ||
))) | ||
)) | ||
))) | ||
tl | ||
)) List<x>); | ||
) List<x>); | ||
|
||
.length := λ(: list List<x>). (: (tail( | ||
.length := λ(: list List<x>). (: ( | ||
(let l 0_u64) | ||
(while (non-zero list) (tail( | ||
(while (non-zero list) ( | ||
(match list ( | ||
() | ||
( (LCons( _ tl )) (set list tl) ) | ||
)) | ||
(set l (+( l 1_u64 ))) | ||
))) | ||
)) | ||
l | ||
)) U64); | ||
) U64); | ||
|
||
reverse := λ(: l List<x>). (: (tail( | ||
reverse := λ(: l List<x>). (: ( | ||
(let r (: LEOF List<x>)) | ||
(while (non-zero l) (match l ( | ||
() | ||
( (LCons( v rst )) (tail( | ||
( (LCons( v rst )) ( | ||
(set r (LCons( v (close r) ))) | ||
(set l rst) | ||
))) | ||
)) | ||
))) | ||
r | ||
)) List<x>); | ||
) List<x>); | ||
|
||
print := λ(: l List<x>). (: (tail( | ||
print := λ(: l List<x>). (: ( | ||
(print '[_s) | ||
(let some False_u8) | ||
(while (non-zero l) (match l ( | ||
() | ||
( (LCons( v rst )) (tail( | ||
( (LCons( v rst )) ( | ||
(if (==( some True_u8 )) (print ',_s) ()) | ||
(print v) | ||
(set some True_u8) | ||
(set l rst) | ||
))) | ||
)) | ||
))) | ||
(print ']_s) | ||
)) Nil); | ||
) Nil); |
Oops, something went wrong.