Various codegen fixes
This commit is contained in:
parent
45578a79b1
commit
22dcbc6a13
7 changed files with 99 additions and 77 deletions
|
|
@ -16,8 +16,15 @@ insertionSort xs = case xs of
|
|||
Nil => xs
|
||||
Nil => Nil
|
||||
|
||||
main = head (insertionSort (Cons 5 (Cons 4 (Cons 3 (Cons 2 (Cons 1 Nil))))))
|
||||
main = head (insertionSort (revRange 1250))
|
||||
|
||||
head xs = case xs of
|
||||
Cons x _ => x
|
||||
|
||||
revRange x = case x of
|
||||
0 => Cons x Nil
|
||||
x => Cons x (revRange (x + minusOne))
|
||||
|
||||
-- represents minus one :)
|
||||
minusOne : Int ;
|
||||
minusOne = 9223372036854775807 + 9223372036854775807 + 1;
|
||||
18
sample-programs/loop.crf
Normal file
18
sample-programs/loop.crf
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
main = for 0 1000
|
||||
|
||||
for x n = case n of
|
||||
0 => 0
|
||||
n => for (revRange 1000) (n + minusOne)
|
||||
|
||||
data List (a) where
|
||||
Nil : List (a)
|
||||
Cons : a -> List (a) -> List (a)
|
||||
|
||||
-- create a list of x to 0
|
||||
revRange x = case x of
|
||||
0 => Cons x Nil
|
||||
x => Cons x (revRange (x + minusOne))
|
||||
|
||||
-- represents minus one :)
|
||||
minusOne : Int ;
|
||||
minusOne = 9223372036854775807 + 9223372036854775807 + 1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue