Групи новин: comp.lang.haskell
Від: maxino <max.korob...@gmail.com>
Дата: Sat, 13 Jun 2009 09:06:53 -0700 (PDT)
Місцевий час: Сб 13 Чер 2009 19:06
Тема: Re: Newbie question...
On Jun 13, 2:28 pm, "Mark T.B. Carroll" <Mark.Carr...@Aetion.com>
wrote: > maxino <max.korob...@gmail.com> writes: Hey Mark, > (snip) > > proper_divisors :: Int -> [Int] > the (floor . sqrt) can't accept an n :: Int, because they need n's type > Prelude> :type sqrt > ... note that the return type is the same as the argument type. From a > Of course, > Prelude> :type mod > mod expects an integral n, and you already declared n to be Int. > How about, > proper_divisors n = [d | d <- [1 .. (floor . sqrt . fromIntegral) n], mod n d == 0] > By the way, though I actually much prefer your convention, upper and > Mark Couldn't have asked for a better explanation. Sorry for the "newbie-ness". Grazie! max(ino) Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
| ||||||||||||||