[Kwartzlab CS] Hack on this
Stephen Paul Weber
singpolyma at singpolyma.net
Thu Mar 21 15:38:50 EDT 2013
Somebody signing messages as Stephen Paul Weber wrote:
>What if we wanted to be able to write functions that can work using either
>Nat or Int, without caring which?
>sum :: (a -> a -> a) -> a -> [a] -> a
>sum _ z  = z
>sum add _ (x:xs) = add x (sum xs)
It has been pointed out to me that there is a function named "sum" in
Prelude, and so if you stick this in a file your compiler may get confused.
So, I suggest just calling it something else, like mySum, when working on
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the CS