Well my professor is doing a chapter over functional languages and he decided he wanted us to try something new. He wants us to program a couple things up in haskell.
I don't know shit about haskell and I've never even touched a functional language, but he expects us to know everything about them for some reason.
does /prog/ know anything helpful about haskell? :(
>>7
slow factorial is slow: *Main> length . show $ floop 30000
121288
(5.58 secs, 794481812 bytes)
compare to this: *Factorial> length . show $ factorial 30000
121288
(0.25 secs, 13860712 bytes)
or even this: Prelude Data.List> let fact = foldl' (*) 1 . enumFromTo 2
(0.00 secs, 0 bytes)
Prelude Data.List> length . show $ fact 30000
(0.77 secs, 786578628 bytes)
Name:
Anonymous2010-04-23 3:31
>>8
hmmm... where did that line go in the last one?
trying copy+paste again: Prelude Data.List> let fact = foldl' (*) 1 . enumFromTo 2
(0.00 secs, 0 bytes)
Prelude Data.List> length . show $ fact 30000
121288
(0.77 secs, 786578628 bytes)
>>8
You are missing the point. It was a combinatorial approach; which is highly related to understanding higher order functions. FAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOT
Name:
Anonymous2010-04-23 12:56
floop.hs ❤_❤
Name:
Anonymous2010-04-23 16:44
floop bood doop beep
Name:
Anonymous2010-04-23 17:45
>>10
how is trying to use a combinatorial approach when it's not appropriate going to help anything? you're just as bad as the idiots who make students implement bubble sort.
>>17
Real World Haskell makes for a great introduction text in a mere seven hundred pages. Learn You a Haskell might be better for somebody who has never even touched the concept of functional programming.
Ofcourse,thefirstandforemostreferenceshouldbeSICP
>>13
I am in favour of having students implement as much as possible even if useless and cliché. Have them deal with sorting algorithms in Scheme all semester and then have them implement MIDI out of the blue for the final test. Oh and let's not forget Conway's Game of Life in Excel using VBA.
Name:
Anonymous2010-04-24 9:17
>>7
I wonder though, aren't you supposed to be writing combinators point-free? And can you refer to the combinator you're defining, like F = SIF?
Here is a list of reasons which make Haskell a good real-life programming language (sorry it's a bit long):
(Post truncated.)
Name:
Anonymous2010-04-24 20:59
I am in favour of having students implement as much as possible even if useless and cliché. Have them deal with sorting algorithms in Scheme all semester and then have them implement MIDI out of the blue for the final test. Oh and let's not forget Conway's Game of Life in Excel using VBA.
telling them to use a combinatorial approach for something it's not appropriate for is only going to make them think the combinatorial approach sucks. why not teach them about situations in which it is appropriate instead?
>>23
We have far too many people going into Computer Science. And most of them aren't really that capable; bunch of stupid geeks that think "I'm not good at anything, but I kinda like computers so I'll be a programmer and make easy moneymonads". The solution is presenting them with tedious nonsense and technical difficulty to surmount. The few that make it through are guaranteed to be technically competent and naturally annoyed at nonsense programming, yet still able to handle it if it came to that.