[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Functional programming general
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 70
Thread images: 4
File: fp-preview.png (34 KB, 500x493) Image search: [Google]
fp-preview.png
34 KB, 500x493
Clojure, F#, Haskell and others.

What do you use, what you like, dislike. Do you use them in your daily job? How difficult were they to learn.

Ask your questions and/or post advice here.
>>
>>51751372

Does it make sense to learn F# if I don't do any .NET programming? Or should I go for something like Clojure.
>>
Haskell vs (some) Lisp?

I think Lisp wins because Haskell's obsession with purity ends up hurting the language.
>>
How is D for functional programming?
>>
>>51751513

How difficult is it to do IO in Haskell?
>>
>>51751372
Started learning Assembly. I want to die.
>>
>>51751513
F# was developed because there is no windows port for Ocaml. The fact that it is implemented in .NET gives it a major head start in libraries. I would recommend Elixir over Clojure if you like Ocaml type of programming. Elixir even has Lisp-macros.
>>
File: bglisp.jpg (42 KB, 500x225) Image search: [Google]
bglisp.jpg
42 KB, 500x225
>>
Use Prolog or fuck off
>>
>>51751372
>function
The point of computers is to perform repetitive tasks. A language based on this principle wouldn't ask the programmer to write the same fucking word repeatedly. Why are language designers such autistic faggots.
>>
>>51751611
>do Fibonacci recursively
>not memoizing the Fibonacci sequence
Enjoy your exponential time, fags
>>
>>51751607
Is there a way to avoid the "do" syntax in Elixir?
>>
>>51751372
>Functional programming general
Please stop this nonsense
>>
>>51751695
>Please stop this nonsense

What?
>>
>>51751694
I dont know why you would want to, its an example of how Elixir makes functional programming more readable. You can always use Erlang, you will appreciate Elixir a lot more when you see how terse Erlang is.
>>
>>51751372
this looks pretty much the same as regular programming to me, except the variable states and shit like return-values are all set automatically, without having to declare them
>>
>>51751372
>Functional programming
does it mean that it does not contain objects at all or that you do everything with functions?
>>
>>51751747

It's just an image I found with the lambda symbol. Ignore the code.
>>
OOPFTW
>>
>>51751577
Not difficult at all.
>>
I'm using monads in my daily javascript job because I love memes.
>>
Currently doing F# because my internship requires it.
I like it so far, though it's difficult to keep things clean when the libraries you work with aren't built for functional programming.
Monads are a pain in the butt to learn, but otherwise very nice tools.
I'd like to do some more Haskell and Common LISP after this.
>>
>>51751865

Have you worked with Clojure yet? If so how does it compare with F#? Does it work better with libraries than F# counterparts?
>>
>>51751878
I haven't worked with Clojure, sorry.
>>
>>51751775
It means you don't sequence operations and instead rely on alpha-reductions of a single functional expression. Objects or types is completely orthogonal.
>>
>>51751896
so functional language has many things already done so you just call a function to do some job as opposed to imperative?
>>
>>51751790
I assume it's from the "Durr Javascript is functional" crowd.
>>
>>51751929
I have no idea what you're trying to say.
>>
>>51751939
It's not? Why senpai?
>>
>>51751945
ok, how would you write a program in functional language to add numbers from 1 to 10?
>>
>>51751747
isn't that all functional programming is? It does all the variable declarations and passing vars around automatically, based on how you use them in the functions?
>>
>>51751947
It's an imperative language with higher-order functions.
>>
>>51751970
but it has lambda too
>>
>>51751961
foldl (+) 0 [1..10]
>>
>>51751970
and closures
>>
>>51751988
well the
[1..10]
part obviously is abstraction right? I mean it already has built in function to know what to do if you just write 1..10.At least I imagine it that way.
From what I understand ,functional languages are a little bit more higher (in the sense of abstraction) than imperative .
>>
>>51752040
>well the [1..10] part obviously is abstraction right?
It's syntactic sugar for
enumFromTo 1 10
.

>From what I understand ,functional languages are a little bit more higher (in the sense of abstraction) than imperative
Now I understand what you're saying. Yes, you are correct. There's also a more direct way to write it as a recursive function:
sum [] = 0
sum (x:xs) = x + (sum xs)

sum [1..10]

One of the appeals of functional language is that you can abstract out this recursion by defining your own "control operator", e.g. the foldl used above
foldl f a [] = a
foldl f a (x:xs) = f a (foldl f a xs)

thus creating a general method to "collapse" lists of elements via this sort of recursion.

Similarly, you can define an "unfold" operation that can be used to abstract out the (co)-recursion from enumFromTo. Or even go as far as to abstract out the "create a recursive data structure and then collapse it with some function" behaviour.

At some point this tends to transition into masturbation or something that is useful only for library designers, but the abstraction can be useful for writing concise and readable code.
>>
>>51752176
Thanks so much for explaining.
>>
> Do you use them in your daily job?
Nobody does this, except the Haskell maintainers.
>>
>>51753071
>Nobody does this, except the Haskell maintainers.

I've seen some jobs that require Clojure, some F# and I believe very few Erlang. Then there's Scala but that's a mixed bag and I don't know who uses it to only program in a functional style.
>>
>>51753125
What jobs are these?
>>
>>51753135

http://careers.stackoverflow.com/jobs?searchTerm=clojure
>>
>>51751372

New material up:
>>51753751

https://storify.com/realtalktech/haskell-has-no-benefits-is-good-for-nothing
>>
>>51753858

Fuck Haskell.
>>
>>51754197

Are you a functional programmer that hates Haskell?

Is there such a thing?
>>
>>51754236

I'm not actually a functional programmer, I just hate elitists. I think I'm more pragmatic and utilitarian.
>>
>>51751392
Personally I loved Clojure. Java interoperability is nice, too.
>>
>>51754323
>loved

Why past tense?
>>
If you want functional programming use Haskell. Brilliant design, don't bother with anything else
>>
File: 1448715927354.gif (2 MB, 480x360) Image search: [Google]
1448715927354.gif
2 MB, 480x360
>>51754447

I will use Haskell.
>>
>>51753071
http://galois.com
>>
>>51751683
>memoizing
>not using the mathematical expression to calculate any arbitrary fib number in constant time
>>
>>51754259
>I just hate elitists. I think I'm more pragmatic and utilitarian.
yep we'd get along

the problem is elitist may infer status of actually being elite. haskell programmers are not at the top in any vertical
>>
>>51751683
>>51754952
>not just using a histomorphism that takes care of memoization internally
histo :: ([a] -> a) -> Int -> a

fib = histo phi where
histo [] = 0
histo [_] = 1
histo (x : y : _) = x + y
>>
>>51751372
nice meme languages
>>
>>51751372
What's the point of those over c++ or c# ?
>>
>>51751372
>general
WOW you put a lot of effort into that post, you should have a copy pasta with resources and general info about them for the beginners, like that computerphile video on youtube.
>>
>>51755321

That fucking sucks. Seriously, fuck your language.
>>
OCaml reporting in

opam/utop for windows never
>>
>>51751878
I did and clojure is fucking awesome anon
If you are into Web development I would totally recommend clojure.
>>
>>51757685
>I don't understand it so it sucks
>>
>>51757560
>make the general more cancerous
This is a good thread that just so happens to be titled "general". Don't encourage anyone to turn it into a regular thing.
>>
>>51759578
I always thought generals were supposed to be regular, it's not my native language.
>>
>>51751611
Did Bill Gates actually say that?

If so, it explains why everything he's ever made is shit.
>>
>>51757082
Easy concurrency.
Very modular and general code.
Very concise. It takes more thought, but saves time.
>>
File: whyamiwearingahelmet.jpg (54 KB, 287x479) Image search: [Google]
whyamiwearingahelmet.jpg
54 KB, 287x479
>>51751372
Is OCaml a meme ?
>>
>>51760017
Yes, but generals are also supposed to not exist in the first place.
>>
>>51751513
>I don't know how to deal with the separation of pure functions and I/O

Babby detected, learn to use functors and applicative functors properly.
>>
>>51760090
No, it's one of the more popular FP languages out there for businesses
>>
I just started learning looking into Elixir (erlang) and like it, but should I continue or am i wasting my time with it?

I'm a webdev and chose it primarily because of the phoenix framework
Thread replies: 70
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.