Add a more elegant while implementation.
This commit is contained in:
parent
b2e7ccfeda
commit
e567872503
|
@ -32,7 +32,7 @@ program =
|
||||||
]
|
]
|
||||||
|
|
||||||
while :: Expr -> Prog -> Stmt
|
while :: Expr -> Prog -> Stmt
|
||||||
while cond body = Loop $ If cond [] [ Break ] : body
|
while cond body = Loop [ If cond body [ Break ] ]
|
||||||
|
|
||||||
sumFromTo :: Int -> Int -> Prog
|
sumFromTo :: Int -> Int -> Prog
|
||||||
sumFromTo f t =
|
sumFromTo f t =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user