Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell Help

Name: Anonymous 2008-10-25 19:41

Haskell beginner here. Anybody know how i shrink this down a bit, sorry I'd figure out myself but i'm sick of learning the same concepts in 20 different languages.

{-

type Month = String

validMonth :: Month -> Bool
validMonth "January" = True
validMonth "February" = True
validMonth "March" = True
validMonth "April" = True
validMonth "May" = True
validMonth "June" = True
validMonth "July" = True
validMonth "August" = True
validMonth "September" = True
validMonth "October" = True
validMonth "November" = True
validMonth "December" = True
validMonth _ = False

-}

Name: Anonymous 2008-10-26 0:35

>>11

Think a little. No program should ever have to compare the name of a month as a string. If anything, it might need the month as a integer.

OP didn't exapnd out what he was trying to do. But its obvious. Month name strings as valid. No proper program or UI is gonna ask that shit. Months are ints and outputted to humans as strings. No human readable date is ever expressed as a integers right? 10/25/2008. No INTEGERS, FUCK! Time on a computer is never epxressed as integers either. You x86 never tracks times as some integer value from some given date. Oh wait nigger it does.

You know what, fuck it. You are obviously a terrible programmer and explaining this is a waste of time. You continue to think that ever constant collection is variable and should be stored in a variable. Who knows, we might add a new month at any reasonable time in the future.

This is way beyond you dude.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List