Article View: pl.comp.lang.funkcyjne
Article #655prosty problem w Haskellu
From: Jan Szumiec
Date: Wed, 22 Dec 2004 11:24
Date: Wed, 22 Dec 2004 11:24
23 lines
1373 bytes
1373 bytes
Cześć, Zacząłęm właśnie bawić się z Haskellem. Mam mały problem z definicją funkcji. Wiem, że musi być trywialny, bo siedzę nad nim od dwóch godzin. Mam funkcję: factorize n m | n == m = [n] | (mod m n) == 0 = n : (factorize n (floor(m/n))) | (mod m n) /= 0 = factorize (n+1) m Gdy uruchomię ją: Main> factorize 2 45 dostaję coś takiego: ERROR - Unresolved overloading *** Type : (RealFrac a, Integral a) => [a] *** Expression : factorize 2 45 Domyślam się, że chodzi o to, że wyjściem z "/" jest liczba niecałkowita, a takiej z kolei może nie akceptować mod.
Technical Details
Message-ID:
<cqblhv$12qf$1@node1.news.atman.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mail From: Jan Szumiec <jps@odpisz-na-grupe.com> Newsgroups: pl.comp.lang.funkcyjne Subject: prosty problem w Haskellu Date: Wed, 22 Dec 2004 12:24:59 +0100 Organization: ATMAN Lines: 23 Message-ID: <cqblhv$12qf$1@node1.news.atman.pl> NNTP-Posting-Host: host-ip102-145.crowley.pl Mime-Version: 1.0 X-Trace: node1.news.atman.pl 1103714687 35663 62.111.145.102 (22 Dec 2004 11:24:47 GMT) X-Complaints-To: abuse@atman.pl NNTP-Posting-Date: Wed, 22 Dec 2004 11:24:47 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit