summaryrefslogtreecommitdiff
path: root/h22.hs
blob: 3557f07c7cac320e06f73a44331244f3d8eef0c4 (plain)
1
2
3
4
5
6
7
8
range :: Int -> Int -> [Int]
range a b | a<=b = a:(range (a+1) b)
          | otherwise = []

range' x y = take (y-x+1) $ iterate (+1) x

range'' a b | a==b = [a]
            | otherwise = a:range'' ((if a<b then succ else pred)  a) b