Is there any way that input values to a function can be pre-defined so that a user doesn't have to define them each time?
For example, assuming I had a function "zr" which returned a list zeros of size n, such that:
zr 1 = [0]
zr 5 = [0, 0, 0, 0, 0]
And so on.
My current way of implementing it is:
zr :: [Int] -> Int -> [Int]
zr x y
| length x == y = x
| otherwise = zr x++[y]
But this isn't particularly elegant as every time I call zr I need to include an empty list as a parameter:
zr [] 5
Any ideas?
Thanks!