Haskell: Recursive Function That Return The Char In A Tuple List With Certain Condition(compare)
I'm learning recursive function in haskell that confused with such conditon: I got a tuple list here: [(0.5,'!'),(1,'*'),(1.5,'#')] What I want to do is input a number n and compa
Solution 1:
tuple is different from array in Haskell
find :: Double -> [(Double,Char)] -> Char
find d [] = ' '
find d (x:xs)
| d <= fst x = snd x
| otherwise = find d xs
Post a Comment for "Haskell: Recursive Function That Return The Char In A Tuple List With Certain Condition(compare)"