Skip to content

Commit

Permalink
arity sensitive!
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Jan 23, 2025
1 parent ba8ac53 commit fbc6ed8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
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.38"
version = "1.20.39"
authors = ["Andrew <[email protected]>"]
license = "MIT"
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

dev: install-production
lm tests/unit/type-inference.lsts
lm tests/regress/3tuple.lsts
cc -O3 tmp.c
./a.out

Expand Down
5 changes: 5 additions & 0 deletions PLATFORM/C/LIB/tuple.lsts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

type Tuple<x,y> = Tuple { first: x, second: y };
type Tuple<x,y,z> = Tuple { first: x, second: y, third: z };

let cmp(l: Tuple<x,y>, r: Tuple<x,y>): Ord = (
cmp(l.first, r.first) && cmp(l.second, r.second)
Expand All @@ -13,6 +14,10 @@ let print(io: IO::File, l: Tuple<x,y>): Nil = (
print(io, "("); print(io, l.first); print(io, ","); print(io, l.second); print(io, ")");
);

let print(io: IO::File, l: Tuple<x,y,z>): Nil = (
print(io, "("); print(io, l.first); print(io, ","); print(io, l.second); print(io, ","); print(io, l.third); print(io, ")");
);

let $"=="(l: Tuple<x,y>, r: Tuple<x,y>): U64 = (
l.first == r.first && l.second == r.second
);
Expand Down
7 changes: 7 additions & 0 deletions tests/regress/3tuple.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import LIB/default.lm;

let t2 = Tuple{ 1, 2 };
print(t2);
let t3 = Tuple{ 1, 2, 3 };
print(t3);
1 change: 1 addition & 0 deletions tests/regress/3tuple.lsts.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(1,2)(1,2,3)

0 comments on commit fbc6ed8

Please sign in to comment.