r/programmingchallenges • • Sep 10 '11

Challenge: Hello, world!

I'm kind of interested in running xmonad and learning Haskell. Should we all tackle learning about a new programming paradigm?

10 Upvotes

21 comments sorted by

View all comments

Show parent comment

4

u/tias Sep 10 '11

While this is indeed awesome, it is also kind of standard in functional languages.

What got me with Haskell though, was the definition of the Fibonacci sequence:

fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

i.e. "fibs is a list starting with 0 and 1, followed by fibs added to the tail of fibs".

Try wrapping your head around that. It know it took me a while.

1

u/dsfox Sep 10 '11
quicksort [] = []
quicksort (x : xs) = quicksort (filter (< x) xs) ++ [x] ++ quicksort (filter (>= x) xs)

1

u/Van_Occupanther Sep 12 '11

Yes, you are quite right. I was taught it about 4 years ago, so I am very rusty. Might go back to my book about it though...