« What would Gandhi Really Do? | Main | Another DSL embedded in Haskell - a partial make replacement in less than 10 lines »

June 04, 2007

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341e003353ef00e5508698b98834

Listed below are links to weblogs that reference Haskell, DSL and Monad:

Comments

handelspand te koop

This is fabulous report. I loved to see your blog with great presentation.

123

how define isDayOfWeek

Miles

Joachim: Noooo! Don't say that! That's what they said about the year 2000...

Miles

Nice, but I'm not sure it's as DSLish as, say, Ruby's

20.minutes.ago
:-)

Pete

Your formula for the number of days in February is not quite right: if the year number is divisible by 100 and not 400, it is not a leap year. So 2000 was a leap year, but 1900 wasn't. You need to replace:

if y `mod` 4 == 0

with

if y `mod` 4 == 0 && (y `mod` 100 /= 0 || y `mod` 400 == 0)

Stelios Sfakianakis

A minor correction: the definition of the leap years should take into account the century years e.g. 1900 was not a leap year. Something like

y `mod` 4 == 0 && y `mod` 100 /=0 
|| y `mod` 400 ==0
will be ok.

cheers, stelios

Joachim Breitner

Just a minor note: Your leap year code is not correct, as every 100th, but not 400th, year is not a leap year. Maybe something like

> if (y `mod` 4 == 0 and y `mod` 100 /= 0) || y `mod` 400 == 0 then 29 else 28

Not that it really matters if the code is wrong in 2100, I guess :-)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Ads




Tip Jar



  • Amazon Honor System Click Here to Pay Learn More
Blog powered by TypePad

Twitter Updates

    follow me on Twitter