
Hi David,
Thanks for the suggestion. I took a quick look at your article, and I'll
have to spend a little more time on it. "Delicious Primes?" Great name.
Also I appreciate your correct use of the phrase "begging the question".
The common and incorrect use that I hear constantly is one of my pet peeves.
Mitchell
-----Original Message-----
From: David Anderson [mailto:dave@natulte.net]
Sent: Sunday, April 25, 2010 11:18 AM
To: mitchell@kaplan2.com
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] I need help getting started
On Sun, Apr 25, 2010 at 6:34 AM,
Hi,
Im just starting to learn, or trying to learn Haskell. I want to write a function to tell me if a numbers prime. This is what Ive got:
f x n y = if n>=y
then True
else
if gcd x n == 1
then f x (n+1) y
else False
primeQ x = f x 2 y
where y = floor(sqrt(x))
The compiler is very unhappy. Apparently theres some ambiguity in this, and Im kind of running around in circles. Id appreciate any help that will get me started.
I won't go over your code, since more skilled people than me are already helping you out with it. However, once you've finished your own implementation, you may be interested in http://blog.natulte.net/posts/2010-04-23-delicious-primes.html . It may give you some interesting insights, imho as the post's author :-). - Dave
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe