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.
Have an array of months and an array of booleans. Also, why are you using Haskell?
Name:
Anonymous2008-10-25 19:45
It's a class assignment, that's not how it would work, what's the point in two arrays, I could just have a hash map if i wanted to make things excessive. Don't know how to do arrays in Shitskell yet anyway.
Name:
Anonymous2008-10-25 20:13
data Month = January | February | March | April | May | June
| July | August | September | October | November
| December deriving (Read, Show, Eq, Ord)
Name:
Anonymous2008-10-25 20:56
Public Enum Months
January
February
March
April
May
June
July
August
September
October
November
December
End Enum
Yeah, I know is not Haskell, its a superior language.
Storing the name of the month as an array of strings in memory is gay and wasteful. There would be no point in a real language or a real program.
Need to get the name for output. If i is the desired month CType(i, Months).ToString
Need to check is some inputted integer is a valid month?
Months.IsDefined(GetType(Months), i)
Well i > 0 AndAlso <= 12 would be better.
I am sick of every fucking compsci teacher thinking that every fucking simple collection they see should be made in to a fucking array. A list of all the months is fucking constant. Does a list of constant values belong in a variable? Constant, variable. Understand the difference.
Seriously faggot, switch teachers to someone not so fucking stupid.
Nigger, the point about putting something as constant as the names of all of the months in an array variable as being fagishly stupid and terrible teaching was apt.
>>10
No it wasn't. How the fuck are you supposed to validate a string when you don't know what would be an acceptable value? And OP never even mentioned a fucking array. And "inputted integer"? What the fuck are you talking about? Who's going to input a fucking integer?
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.
>>12
Sorry, I can't think as little as you. None of that shit you're babbling about has anything to do with the problem, the OP, or his teacher. No one here is putting the months in a variable OR an array, and we're not designing a fucking enterprise data entry interface.
Name:
Anonymous2008-10-26 1:18
Gee it sure is first year computer science around here.
Haskell the Dog would be rolling in her grave if she saw what her precious /prog/ has turned into.
/prog/ where a proper computer programming language implementation of a basic concept is called "enterprise" and dismissed.
You idiots can't understand real programming. Its why I get paid the big bucks, to fix your idiot fuck ups and wright correct code.
All of you are fucking Indians with 3rd world "programming" degrees.
Name:
Anonymous2008-10-26 5:27
All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees. All of you are fucking Indians with 3rd world "programming" degrees.
>>17
Damn right we are. And they better keep mum about it if they want to keep their H-1Bs
Name:
Anonymous2008-10-26 7:13
>>16
I don't even know who or what you're trying to argue against. I'm a bit worried about your mental health. Anyway, >>4,6 already provided the proper answer to the OP's question. Since you clearly know nothing about Haskell, why don't you just stay out of the discussion?