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

Halp /prog/ :(

Name: Anonymous 2010-04-22 21:19

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? :(

Name: Anonymous 2010-04-22 21:30

Gentle introduction to Haskell http://www.haskell.org/tutorial/

Name: Anonymous 2010-04-22 22:49

for functional programming in general: http://www.thinkartlab.com/pkl/media/SUSHIS_LOGICS.pdf
for haskell: http://learnyouahaskell.com/

Name: Anonymous 2010-04-22 23:02

>>3
Wait, hold on... is that Sushi's Logic thing for real?

Name: Over 9000 Thread 2010-04-23 1:01

Somebody has posted Sushi's Logics.
You can't reply anymore.

Name: Anonymous 2010-04-23 2:39

>>4
WTF was he high on when he wrote that.

Name: Anonymous 2010-04-23 2:40

floop.hs:

boop foop gee goop       = foop goop (gee goop)
ping goop zoom           = goop
oot foop gee goop        = foop (gee goop)
pop foop gee goop        = foop goop gee
zoom foop                = foop (zoom foop)
cond bloop foop gee goop = if bloop goop then foop goop else gee goop
floop  = zoom (oot (cond ((==) 0) (ping 1)) (oot (boop (*)) (pop oot pred)))

Execution:

$ ghci floop.hs
[1 of 1] Compiling Main             ( floop.hs, interpreted )
Ok, modules loaded: Main.
*Main> let factorial = floop
*Main> map factorial (take 10 [1..])
[1,2,6,24,120,720,5040,40320,362880,3628800]

Name: Anonymous 2010-04-23 3:25

>>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: Anonymous 2010-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)

Name: Anonymous 2010-04-23 8:01

>>8
You are missing the point. It was a combinatorial approach; which is highly related to understanding higher order functions.
FAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOTFAGGOT

Name: Anonymous 2010-04-23 12:56

floop.hs
❤_❤

Name: Anonymous 2010-04-23 16:44

floop bood doop beep

Name: Anonymous 2010-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.

Name: Anonymous 2010-04-23 19:03

Name: Anonymous 2010-04-23 20:07

>>14
I didn't think one could cripple such a beautiful thing in so many imaginative and interesting ways.

Name: Anonymous 2010-04-23 21:32

>>15
DIDN'T MY ANUS

Name: Anonymous 2010-04-24 4:16

Name: Anonymous 2010-04-24 8:23

>>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.

Of course, the first and foremost reference should be SICP

>>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: Anonymous 2010-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?

Name: Anonymous 2010-04-24 9:35

>>19
There is no rule that says combinators have to be point-free.

Name: Anonymous 2010-04-24 20:36

Real World Haskell
Implying anyone every uses U MENA HASKAL outside of a classroom / computer lab setting.

You funny.

Name: Anonymous 2010-04-24 20:44

>>21
The joke was obvious. You get no credit.

Here is a list of reasons which make Haskell a good real-life programming language (sorry it's a bit long):

(Post truncated.)

Name: Anonymous 2010-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?

Name: Anonymous 2010-04-25 0:30

>>23
Because there aren't any.

Name: Anonymous 2010-04-25 2:53

>>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.

Name: Anonymous 2010-04-25 3:51

>>22
A+++++++++ grate post would read again

Name: Anonymous 2010-04-26 6:17

>>3
Lol at learnyouahaskell.com, good read

Name: Anonymous 2010-04-26 15:39

>>1
youmenahaskal.comu

Name: Anonymous 2010-11-15 22:40

Name: Anonymous 2011-02-03 0:27

Name: Anonymous 2011-02-03 0:35

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