/fpt/ - Fun(ctional) Programming Thread

Next-level programming thread!

What are you going to learn today?

Resources on:
>Erlang
learnyousomeerlang.com/content
>Haskell
en.wikibooks.org/wiki/Haskell

More resources on more languages to come!

Other urls found in this thread:

chimera.labs.oreilly.com/books/1234000001642/index.html
youtu.be/xrIjfIjssLE?t=71
youtube.com/watch?v=p1LjmDCOM-8&
github.com/ocharles/netwire-classics
eecs.ucf.edu/~leavens/ComS541Fall97/hw-pages/paradigms/major.html
en.wikibooks.org/wiki/Haskell
twitter.com/NSFWRedditVideo

>using fringe languages

Good luck with your life.

What's the point of Erlang when you know C?

What's the point of C when you know Haskell

How do we convert imperative programmers?

>stealing my rare picture
Rude desu
Building scalable, fault tolerant systems?

Nice 404..

Here's a good ressource for Elixir:
chimera.labs.oreilly.com/books/1234000001642/index.html

that's what Ada is for

It's shorter:
youtu.be/xrIjfIjssLE?t=71

>Ada
Pure meme-language that no one uses

youtube.com/watch?v=p1LjmDCOM-8&
Pretty good music video, I was thinking of showing it to Joe Armstrong but I would just look like an autist harassing him on campus

It's never memed anywhere. How is it a meme language?

good choice user

How do logic languages differ much from functional languages?

Ada isn't made for fault-tolerant distributed systems. Ada excels at fault-tolerant real-time systems.
You want Ada in your car and Erlang to handle web traffic or telecommunication.

"meme" has become synonymous with "joke" with younger people, they're saying Ada is a joke language not that people post about it often.

In logic languages you write a set of rules.
In functional languages you write a set of functions that you can combine to transform data like a long pipeline.

Logic languages are great at expressing rules of systems, for instance game rules. One of my friends once made a language made to describe card games, and he did it as a logic language.
Worked out really well. We even thought about how to express board games, like chess, in it through stacks of cards to represent physical dimensions..

Ada is used for distributed systems.
The institute for distributed systems at my uni uses mostly Ada.

He actually links to that video on his github page.

Cool, didn't really think people wrote Ada that much more.
But Erlang is used for 50% of the world's telecommunication. Why would you use Ada instead of Erlang for this? Erlang was designed for this.

Because dynamic typing is pig disgusting

Cool, didn't see it. I hope he has the course about distributed systems when I take it

We don't. We enjoy the fact our salaries pay higher because of the niche and enjoy our wonderful pure functional algorithms.

you need a balance
it has to be common enough that jobs exist

You're right but in big cities I've had no trouble finding Scala/haskell jobs. Also the barrier to entry is higher for functional Langs.

>big cities
So all your extra money goes into the higher rents

but what if i want to live in a comfy majority-native english town

I'm learning haskell and it's very different from imperative languages. It looks like an advanced calculator.

So, what is haskell used for? I code vidya as a hobby, and haskell doesn't seem to be the right tool to make, say, an mmo.

Generally the salaries are high enough to make the rents irrelevant. Currently Scala pays extremely well .

finally an actual programming thread

It's a general purpose programming language.
You can use it for whatever you like.

Remember that it's garbage collected though, so it can never be as fast as C.

Unfortunately this is the con with niche tech.

Server side Haskell would do really well for an mmo. The idea is stateless so you can instantly scale servers if you get a spike in players

It's not even as fast as Java or Go

quick piece of information that people in this thread will so obviously overlook. bram cohen wrote the first bit torrent client in haskell - the first ever implementation of the bit torrent protocol was written in haskell - as in a groundbreaking piece of software that is used to download upwards of millions of files everyday was written in haskell.

really makes you think.

>anti Haskell poster
>literally Satan
Get out of God's thread

Huh?
He used Python.

Fpt what are your favourite functional programming books?

It's not my fault that even an Apple developed language performs better than Haskell.

optimised haskell could outperform java

Then come back when it does.

i'm back

What kind of programs do you write in functional languages? Analyzing huge amounts of data?

I get the feeling that a functional program basically has one very specific task, is that correct?

Post your new benchmarks.

No, functional programming is very general purpose.

You wouldn't use it for vidya. Functional programming is a great paradigm for manipulating static sets of data in an abstract way. Video games involve mutating sets of dynamic state and passing it around to other actors. Also, there's not enough libraries for it in Haskell and that's going to be your primary need for making video games unless you feel like spending a year reinventing the wheel on your own.

I don't mean functional programming, I mean one single program written with it.
So I don't expect something like a web browser to be written in a functional programming language but rather something like grep or cat or a component in a bigger program.

Functional programming can definitely be used for that, because it's composable. I'd say using something like grep or cat is a kind of functional programming.

>using normie languages

Good luck with your sanity.

Coroutines and state monad. To play devil's advocate. Not sure how well it would perform. But xmonad is written in Haskell.

bump

inb4 >side effects

What's the point of Erlang, C and Haskell when you know PHP?

Erlang, C and Haskell are enjoyable
PHP makes you want to kill yourself

>Server side Haskell would do really well for an mmo. The idea is stateless so you can instantly scale servers if you get a spike in players
HAHAHAHAHAHAHAHAHA

sorry but HAHAHAHAHAHAHAHAHAHAHA

FRP

github.com/ocharles/netwire-classics

>I get the feeling that a functional program basically has one very specific task, is that correct?
Every program basically has one specific task. (Well, except for the mobile market, where ‘apps’ need to sell ‘experiences’)

You can use functional languages to write the same types of programs that you can write with any other language

>making an asteroids clone means it's suitable for an MMO
I already know about FRP. Is this a joke post? Anyone can make an asteroids clone in their language of choice. Doesn't make it good for an MMO.

Well, I'm not really sure what your question is. Which part of an MMO are you trying to implement and what are you stuck on?

Functional programming is good for any application

I'm:

Mutation is easy in FP and pure FP

You claimed state is not possible in FP. We provided multiple examples otherwise. Not sure what else you're still unsure about?

btw, the only reason you wouldn't write an MMO in Haskell is because of GC pauses. Same reason you wouldn't write it in any other language with GC

>You claimed state is not possible in FP.
Nope, I didn't. I don't see the point in arguing that though, since I also regularly use functional programming languages and the last thing I'm interested in is entertaining debates about what people think you should or shouldn't be doing with them. Unfortunately, real-time (vs. turn-based) mmo's aren't one of them.

>Unfortunately, real-time (vs. turn-based) mmo's aren't one of them.
Yes, because of GC pauses. If you could make a GC-free funtional language (is such a thing possible?) it wouldn't be an issue

Can someone explain to me the difference between the imperative and functional paradigms? Without mentioning state.

In imperative you program in a way similar to how your computer works.
In functional you pretend your computer shuffles mathematical expressions around.

The opposite of imperative is declarative, not functional

Imperative: You describe how to accomplish the result you want
Declarative: You describe the result you want to attain

Default behavior in

imperative:

x is 5
y is 5
x = x + y
x is 10

functional:
x is 5
y is 5
x = x + y
Error: x already bound to 5
x' = x + y
x' is 10
x is 5

>immutability is the only difference between functional and imperative

This is the dumbest post I've read all day

Read the post more carefully lad.

>Enter thread
>See erlang
>Leave thread
Bye.

It's as musch functional, as Haskell, y'know.

How did you write this if you left the thread? Your post doesn't make a whole lot of sense.

Now mention the other differences.

eecs.ucf.edu/~leavens/ComS541Fall97/hw-pages/paradigms/major.html

We have enough thread splitting, get back into /dpt/ and stop being autistic, the lot of you.

One board, one programming general.

Newfags, ladies and gentlemen.

>Server side Haskell would do really well for an mmo
>implying haskell compile in quantum-machine cone instead of regular machine code as any fucking programming language does in the end
>implying haskell ins't made using C in the core

>implying your OS doesn't use a kernel programmed in C

Could someone please explain the difference between procedural and functional programming? I'm dumb

Have you ever made a burrito?

mainly higher order functions

Something something monads, promises.

It doesn't

>C
>Enjoyable
C and PHP are literally the exact same language.

What does it mean when a candlestick has multiple wicks like that in Go, Fortran, Chapel, et al.? Shouldn't it just be one long upper wick?

>Vidya functional
>not OCaml
u dun goofed.

Haskell is objectively the worst functional programming language. Prove me wrong.

x :: HaskellIsTheBestProgrammingLanguage
x = x

Just because you're too big of a pussy to handle a proper language like C doesn't mean it's bad.

reading this thread I feel like asking: is worth learning Haskell? or should I stay with clojure?

Yes

No

wtf?

en.wikibooks.org/wiki/Haskell

What OS user?

Apple Macintosh OS X

XNU is written in a mix of C and C++

But it isn't. It's written in Objective C and C++