Skip to content

Commit

Permalink
iterate failing
Browse files Browse the repository at this point in the history
  • Loading branch information
vidsinghal committed Oct 30, 2023
1 parent 5361c99 commit c748904
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions gibbon-compiler/examples/test_iterate.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


data List = Cons Int List | Nil

addOneList :: List -> List
addOneList lst = case lst of
Nil -> Nil
Cons x rst -> let newVal = iterate (addOne x)
newRst = addOneList rst
in Cons newVal newRst


length :: List -> Int
length lst = case lst of
Nil -> 0
Cons x rst -> 1 + length rst

addOne :: Int -> Int
addOne x = x + 1


mkList :: Int -> List
mkList len = if len <= 0 then Nil
else Cons len (mkList (len-1))




gibbon_main = length (addOneList (mkList 10))
3 changes: 3 additions & 0 deletions gibbon-compiler/tests/test-gibbon-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -915,3 +915,6 @@ tests:
answer-file: examples/layout_bench/manyFuncsGlobal.ans
failing: [interp1,pointer,gibbon1, gibbon3]
run-modes: ["gibbon2"]

- name: test_iterate.hs
skip: true

0 comments on commit c748904

Please sign in to comment.