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

What /g/ think about functional programming

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 63
Thread images: 15

:^)
>>
File: 1469099464329.jpg (44KB, 282x341px) Image search: [Google]
1469099464329.jpg
44KB, 282x341px
>>60844525
What is functional programming?
>>
>>60844665
Programming something that just werks :^)
i fink
>>
File: 1438982991127.jpg (27KB, 447x444px) Image search: [Google]
1438982991127.jpg
27KB, 447x444px
>>60844701
>something that just werks
you mean like objects?
>>
>>60844723
i mean like windooz 10 or jewgle chrome
>>
>>60844665
Input produces same output independent of program state.
>>
>>60844795
Oh..
>>
>>60844525
Good for specifying what you want the behaviour of a program to be, because pure mathematical functions are probably the most simple common abstract structure for expressing a relation.

Functional languages are often quite slow, though, so I think the ideal way of looking at this is to specify what the program should do in a functional language, and then use the functional language to prove a fragment of imperative code has the desired properties.
>>
File: 1359654183792.png (185KB, 580x323px) Image search: [Google]
1359654183792.png
185KB, 580x323px
>>60844762
so windows and chrome are programming functions?
>>
>>60844795
What? No. That's just a side effect of a program being functional.

Functional programming is when you avoid having any sort of 'state' in your program like mutable variables.
>>
>>60844723
kek
>>
But I like jumping around the codebase and looking for what the fuck is that global variable... just kidding. It's healthy approach, but purely functional languages are weird and do not perform so well to jump into it.
>>
>>60845047
Nah, functional as something that "werks :^)"
>>
File: 1490247379435.jpg (402KB, 730x780px) Image search: [Google]
1490247379435.jpg
402KB, 730x780px
>>60845123
>what are functions?
>just werks
>like objects?
>no like windows and chrome
>windows and chrome are functions?
>no, functions just werk
N-NANI?!
>>
I think its cool. It's not a system I rely on, and I wouldn't write any large software in a purely functional language, but there are cases where I prefer a functional approach to accomplishing something.
>>
>>60845147
Dunno how to explain it to you homie
>>
File: 1405731330414.jpg (57KB, 339x272px) Image search: [Google]
1405731330414.jpg
57KB, 339x272px
>>60845197
>>
File: ughh....gif (627KB, 500x280px) Image search: [Google]
ughh....gif
627KB, 500x280px
>>60845264
S-Sorry... ;_;
>>
I need halp.
I know quite a few fuctional languages and theory around them; I started programming with O'Caml, write an interpreter, a few UI shit and a vectorial editor in F#.
I want to take a leap and learn Haskell and put my semantics theory and theorem proving knowledge at use, but I can't find a suitable lang reference doc for my level, just introductory-level shitty tutorials.
Can you help me out?
>>
>>60845147
post more of this, also source
>>
>>60846649
https://en.wikibooks.org/wiki/Haskell

Skip the chapters you already know about.
>>
>>60846691
>https://en.wikibooks.org/wiki/Haskell
based, thanks
>>
File: 1496384714323.jpg (60KB, 640x480px) Image search: [Google]
1496384714323.jpg
60KB, 640x480px
>>60846691
>Haskell
Ugh. Miss me with that gay shit.
Talk to me when you learn scala
>>
>>60844525
It's really good for symbolically deriving hierarchical equations. It gave me a few easy papers.
>>
File: Screenshot_2017-05-23_08-56-36.png (821KB, 1366x768px) Image search: [Google]
Screenshot_2017-05-23_08-56-36.png
821KB, 1366x768px
>>60844525
You have to leave the past behind and move into the future.
>>
Did I enter /s4s/ and did not notice it?
>>
>>60844525
I like programing without loops and if-else
>>
>>60844525
>>60844701
>>60845123
>using the smiley with a carat nose
>>
>>60848164
>Not using the smiley with a carat nose
>>
>>60844525
Useful for some use cases, but otherwise a meme. And a slow one at that.
>>
File: 1460358182233.jpg (250KB, 800x970px) Image search: [Google]
1460358182233.jpg
250KB, 800x970px
>>60846680
source is the internet
>>
File: dpt.jpg (164KB, 800x1000px) Image search: [Google]
dpt.jpg
164KB, 800x1000px
>>60844525
>>
FP BTFO
>>60850346
>>60850478
>>
>>60846735
Programming noob here, is this bait? Why has nobody mentioned scala? Are rust and haskell /g/ memes? Explain me
>>
>>60844665, >>60844701, >>60844762, >>60845047
>Just werks ;^)
>I don't understand
Anon was making a shitty joke about functional meaning something functions.
Am I falling for bait?
Are these other Anons actual human beings?
>>
File: church_alonzo.jpg (17KB, 340x282px) Image search: [Google]
church_alonzo.jpg
17KB, 340x282px
I'm a mathfag

I prefer it over anything else, but it seems to be basically useless in the real world except for very niche applications.
>>
>>60844525
I only ever used Erlang and started some emacs LISP basics, so my experience is quite limited, but I find that it works quite well when working on something that is most simply represented as a state machine. So I would definitely use a functional language when implementing something used in networking, like a server of some kind, but I'd never use it for working on a program that manages organized hierarchical sets of data, parses and writes them to/from JSONs and XMLs and such. And of course, then there's some other benefits that are language specific that Erlang has quite a few of.
>>
what about F#, g
>>
Functional programming in (((LISP))) may be good, but I have yet to see a good syntax for it other than presenting it in syntactical trees.
>>
>>60851845
trashkell is good on paper but don't expect to code anything useful on it.
Programming without state is only feasible for certain applications. For real everyday stuff you want a procedural/OO language that also allows some functional tricks, or an environment that allows using multiple languages seamlessly (like C# and F#, Java and Scala)
>>
>>60844525
elm & elixir are comfy
>>
>>60852848

Feasibility isn't quite the right way of looking at it: you can make any stateful application into a pure one with enough BS but it can get very messy. It depends on how stateful the application is.
>>
File: really makes you think.png (85KB, 388x218px) Image search: [Google]
really makes you think.png
85KB, 388x218px
What's a good way of making something like a C struct in scheme?
Should I just use a hash table and get values with symbols, or are there better solutions?
>>
File: smooth-spiral.png (13KB, 167x246px) Image search: [Google]
smooth-spiral.png
13KB, 167x246px
>>60844525
I think pure FP isn't really production-ready yet.

Getting the types and functions of a standard library done well enough is an ongoing experiment of sorts.


Hybrid FP + OOP or Imperative is already the industry production standard for big data & big processing (and related machine learning etc). There is actually no other way that worked nearly as well.
>>
>>60854965
I'd probably make a list of name-value pairs. Might be a bit inefficient storing a copy of the names for each copy of the struct, but I doubt people are that concerned about memory usage using scheme.
>>
>>60844701
>>60844762
>>60845123
>>60846818
What the fuck is this shit?
>>
up
>>
>>60848164
˙͜>˙
>>
I use it every day for work (OR PhD) and it is usually just the way programming should be done.

If it runs slow, it's probably because you programmed badly.
>>
>>60852209
>quoting the smiley with a carat nose
>>60855825
>using the rotated smiley with a carat nose
>>
>>60857868
>quoting someone quoting the smiley with a carat nose
>quoting someone using the rotated smiley with a carat nose
>>
>>60846649
>O'Caml
It's called OCaml, you moron.
>>
>>60844525
half life 3 is coming
>>
>>60845147
>>>/a/
>>
Just started learning Scheme.
>>
The functional mindset will make you a better programmer, so it's worth learning even though for all practical projects you're going to use oop
>>
>>60859494

OOP and Functional paradigms are more similar than you might think. Becoming a better functional programmer will make you a better OOP programmer.
>>
>>60859565
>tfw a majority of programmers today don't know how to write good code
>>
>>60844525
Not fit for the current architecture of commonly used machines.
>>
>>60859033
>>>/reddit/
>>
File: ea3.jpg (45KB, 600x600px) Image search: [Google]
ea3.jpg
45KB, 600x600px
>>60860182
>Not fit for the current architecture of commonly used machines.
git gud
>>
>>60844525
What are the downsides really.
>>
up
Thread posts: 63
Thread images: 15


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.