[Haskell-beginners] Enum for natural numbers
kane96 at gmx.de
kane96 at gmx.de
Fri Dec 18 09:34:39 EST 2009
ok, but I shall use Enum in the exercise.
-------- Original-Nachricht --------
> Datum: Thu, 17 Dec 2009 13:56:30 -0500
> Von: "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu>
> An: kane96 at gmx.de
> CC: "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu>, beginners at haskell.org
> Betreff: Re: [Haskell-beginners] Enum for natural numbers
> On Dec 17, 2009, at 12:21 , kane96 at gmx.de wrote:
> > toEnum should return Z for negative numbers. I did something like
> > this but the problem is I don't know how to set "less than". I tried
> > > and lt:
> >
> > instance Enum Nat where
> > toEnum (gt 0) = S Z
> > toEnum (lt 1) = Z
>
>
> Take a look at guards.
>
> --
> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university KF8NH
>
>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the Beginners
mailing list