Hi

Here are some (IMHO) beautiful solutions in F# for primality.

1
http://cs.hubfs.net/forums/thread/5151.aspx

My first experience with functional programming was with Haskell. When I want the properties of a Haskell lazy list I use a Seq. I know there's also a Lazy List but i haven't used it.

By on 3/11/2008 8:42 AM ()

[link:cs.hubfs.net]

Thanks! The sequence solution,
Seq.exists (fun n -> x % n = 0) {2..x-1}
is apparently the F# way of doing it.

BTW, they've missed something about prime testing in the linked thread, so I've written in it.

By on 3/12/2008 7:15 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper