Skip to content

Commit c748904

Browse files
committed
iterate failing
1 parent 5361c99 commit c748904

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
data List = Cons Int List | Nil
4+
5+
addOneList :: List -> List
6+
addOneList lst = case lst of
7+
Nil -> Nil
8+
Cons x rst -> let newVal = iterate (addOne x)
9+
newRst = addOneList rst
10+
in Cons newVal newRst
11+
12+
13+
length :: List -> Int
14+
length lst = case lst of
15+
Nil -> 0
16+
Cons x rst -> 1 + length rst
17+
18+
addOne :: Int -> Int
19+
addOne x = x + 1
20+
21+
22+
mkList :: Int -> List
23+
mkList len = if len <= 0 then Nil
24+
else Cons len (mkList (len-1))
25+
26+
27+
28+
29+
gibbon_main = length (addOneList (mkList 10))

gibbon-compiler/tests/test-gibbon-examples.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,3 +915,6 @@ tests:
915915
answer-file: examples/layout_bench/manyFuncsGlobal.ans
916916
failing: [interp1,pointer,gibbon1, gibbon3]
917917
run-modes: ["gibbon2"]
918+
919+
- name: test_iterate.hs
920+
skip: true

0 commit comments

Comments
 (0)