No title

olligobber 2018-02-13 08:26:16.543785 UTC

1-- Simplifies an expression up to a certain number of times
2interpretTimes :: Maybe Integer -> (Integer,Expression) -> (Integer,Expression)
3interpretTimes (Just 0) x = x
4-- seq m forces the evaluation of m
5interpretTimes n (m,x) = seq m $ case simplify x of
6 Nothing -> (m, x)
7 Just y -> interpretTimes (pred<$>n) (m+1,y)