[Haskell-beginners] Re: Integer factorization
apfelmus at quantentunnel.de
Sat Mar 14 04:39:18 EDT 2009
Colin Paul Adams wrote:
>>>>>> "Heinrich" == Heinrich Apfelmus <apfelmus at quantentunnel.de> writes:
> Heinrich> Abstraction is the one driving force for very short
> Heinrich> names. For example, take the definition of foldr
> Heinrich> foldr f z  = z foldr f z (x:xs) = f x (foldr f z
> Heinrich> xs)
> Heinrich> Since this function is polymorphic, so f , z and the xs
> Heinrich> can be anything, using more "descriptive" variable names
> Heinrich> is simply not possible; the key point of fold is its
> Heinrich> generality.
> Wouldn't unit be a better descriptive name than z?
I have never heard of a unit in relation to fold , I'm afraid. Monoids
and groups have units, as do physicists and a few other mathematical
While z is indeed quite often the unit of a monoid, for instance in
sum = foldr (+) 0
product = foldr (*) 1
concat = foldr (++) 
it doesn't have to be the unit of a monoid.
More information about the Beginners