1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00

Numeric range types (#2232)

* Closes #2145
This commit is contained in:
Łukasz Czajka 2023-06-28 17:24:08 +02:00 committed by GitHub
parent 755f02ab4c
commit b4347bdd23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 2 deletions

@ -1 +1 @@
Subproject commit 149dc68479c794d645ca6abadc3aa948d43dd9da
Subproject commit 034c5236afb1c7b9dc0aa6754515001f5694cc7e

View File

@ -344,5 +344,10 @@ tests =
"Test057: Case folding"
$(mkRelDir ".")
$(mkRelFile "test057.juvix")
$(mkRelFile "out/test057.out")
$(mkRelFile "out/test057.out"),
posTest
"Test058: Ranges"
$(mkRelDir ".")
$(mkRelFile "test058.juvix")
$(mkRelFile "out/test058.out")
]

View File

@ -0,0 +1 @@
7550

View File

@ -0,0 +1,14 @@
-- ranges
module test058;
import Stdlib.Prelude open hiding {for};
import Stdlib.Data.Nat.Range open;
sum : Nat → Nat;
sum x := for (acc := 0) (n in 1 to x) {acc + n};
sum' : Nat → Nat;
sum' x := for (acc := 0) (n in 1 to x step 2) {acc + n};
main : Nat;
main := sum 100 + sum' 100;