Skip to content

Commit 3436d21

Browse files
committed
Add TCO example
1 parent f9e20c7 commit 3436d21

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Main.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,15 @@ examples =
265265
, " isEven sum"
266266
, " return sum"
267267
]))
268+
, ("tco",
269+
("Tail-Call Elimination",
270+
unlines [ "module TailCall where"
271+
, ""
272+
, "factHelper prod 0 = prod"
273+
, "factHelper prod n = factHelper (prod * n) (n - 1)"
274+
, ""
275+
, "fact = factHelper 1"
276+
]))
268277
]
269278

270279
page :: Maybe String -> Maybe String -> Maybe Response -> ActionM ()

0 commit comments

Comments
 (0)