• Log in or sign up for an account here: https://www.sythe.org/login

Functional Programming

SuF

Legend

Pirate
Retired Global Moderator
Joined
Jan 21, 2007
Sythe Gold
1,234
Messages
14,211
Discord Unique ID
203283096668340224
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
I love it. Haskell is by far my favorite language. Anyone else tried it or do it?
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
I poked around F# a bit out of curiosity...Didn't like it. We'll be doing Haskell next year in my degree program. Not looking forward to it :P
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
I poked around F# a bit out of curiosity...Didn't like it. We'll be doing Haskell next year in my degree program. Not looking forward to it :P

Hit me up if you need help. I hated it at first until I went back to it. You can to think about issues in a completely different way. But map and folds are fucking awesome.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Check out Clojure. Recently learnt it at my internship. Hated it first. Then found it out how amazing functional languages can be.

Same with me and Haskell. Hated it until I kept doing it.

I <3 Haskell!

Its like writing out math!

I thought I'd always be a Python-masterrace person, but not anymore!

It really is. I am a Haskell master race sort of person now.
 
Chess Master
It really is. I am a Haskell master race sort of person now.

It seems like a hassle to learn at first, but it really changes the way you think about stuff. Like whenever I do python now I just think "Why doesn't this have a very convenient takeWhile" etc etc.

Also the annotations are really nice.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
It seems like a hassle to learn at first, but it really changes the way you think about stuff. Like whenever I do python now I just think "Why doesn't this have a very convenient takeWhile" etc etc.

Also the annotations are really nice.

Yes. It is a whole different way of looking at problems. I also hate for loops now. Iterators are also stupid. Map is the the way of the future.
 
Chess Master
Yes. It is a whole different way of looking at problems. I also hate for loops now. Iterators are also stupid. Map is the the way of the future.

>inb4 iterate is a function in haskell

Code:
f x 
    | even x = x/2
    | odd x = (x*3) + 1

take 5 . iterate f $ 23

lel (inb4 code doesn't work - I haven't run this).

But yes, I agree with you.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
>inb4 iterate is a function in haskell

Code:
f x 
    | even x = x/2
    | odd x = (x*3) + 1

take 5 . iterate f $ 23

lel (inb4 code doesn't work - I haven't run this).

But yes, I agree with you.

They have their place but I find map much more useful.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
yeah, me too. I really like how you can use map to construct types and currying functions etc instead of just applying a function to a list of values.

Yea. Abstracting away what a for loop essentially does is epic. It allows you to do such powerful stuff. Monads are another great example. Abstract shit enough and it all fits a very similar mold.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Question -- SuF, if you were to write a Haskell program to generate all permutations of a list, how would you do it? (This was an exercise I gave myself, but I'm trying to find better ways to do it because my way is slow -- takes ~ 3 seconds to generate all of them for 10 elements).

I wouldn't know off the top of my head. You can look at this source: http://hackage.haskell.org/package/base-4.7.0.1/docs/src/Data-List.html#permutations

It seems kinda ugly but that is in the GHC standard library.
 
duelarena.gg
Back
Top