[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/prog/ - Programming

Programming board

Catalog

8chan Bitcoin address: 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C
The next generation of Infinity is here (discussion) (contribute)
A message from @CodeMonkeyZ, 2ch lead developer: "How Hiroyuki Nishimura will sell 4chan data"
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


ef4404 No.843

Let's get into it. Lambda Calc, Pi Calc, Type systems, Macros, Monads, and even continuations.

834836 No.847

File: 1418470322346.gif (244.97 KB, 500x281, 500:281, fikqln.gif)

can purely functional programming languages be used for performance critical systems programming?

b56701 No.853

>>847
Computers are based around modification of state. If we don't take potential bugs into account (perfect code) and both are as optimised as possible using current methods, the functional program will always be slower than the program that takes advantage of mutability.

If you want stable, use functional programming. If you want fast, be as impure and mutable as you can.

5d4b86 No.854

>>847
Depends on what you mean by systems programming. If you're talking about writing drivers, where directly mutating memory is literally required, then no.

However, I disagree with >>853, because what compilers for purely-functional languages do is to convert the mathematical entities expressed by the source code into assembly code, including all necessary mutations. I see no reason why a good compiler couldn't generate code that's just as fast as an imperative program. SBCL and GHC are two examples of compilers for functional languages which produce blazingly fast binaries.

ef4404 No.860

>>853 SBCL and CCL are amazing in that regard. The language forms around whatever paradigm you want to use, albeit discouraging the style of "be as impure and mutable as you can" and will produce fast code.

You might like Erlang though. It's functional-lite, and I recommend it only because I get the feeling Haskell isn't your thing.

f78897 No.891

>>853
Actually, you mental fucking midget, functional PLs allow for compilers to statically analyze the pure computations and hence do shitloads of optimizations including, but not limited to, memoization, code-folding, automatic parallelization, etc. So you see functional PLs actually transcend concerns of speed. Now go back to scrubing toilets you filthy casual.

23b3c5 No.902

>>860
My only issue with SBCL is that the binaries it produces are fucking enormous. If I remember right, hello world was roughly 30mb. Obviously, it would scale fairly normally, but I still think that's a bit much.

Someone told me that if you define unused functions in the image as nil, they won't be included. Is there an automatic way to do this?

23b3c5 No.906

>>902
>binaries
'Executables' is more accurate.

455d3a No.910

OCaml is nice. The native compiler generates really nice assembly and OCaml generally translates well into it.

ef4404 No.940

>>891
Shit, you told 'em.

81fabf No.1008

>2015
>still thinking functional program should be used for anything serious other than "le ebin sorting algorithm"

d38db3 No.1009

>>891
>Actually, you mental fucking midget, C++11 allow for compilers to statically analyze the pure computations and hence do shitloads of optimizations including, but not limited to, memoization, code-folding, automatic parallelization, etc. So you see C++11 actually transcend concerns of speed. Now go back to scrubbing toilets you filthy casual.
ftfy
>>1008
You can hardly beat functional style on code density and generic-ness, which are required for a project to scale well.
It sucks being restrained to
'no internal state' and 'iteration only through recursion' purism though, as iteration and stateness are heavily required from most RealLifeā„¢ applications.
>we really need a C++ flag around these parts

777a6f No.1016

anyone scala here?

50552a No.1018

Haskell is a language of mental midgets. They pride themselves on "purity" but allocate memory with everything they do. They pride themselves on "security" but even a freaking () can be a bottom that gobbles up your memory for the lulz.

110ed0 No.1024

>>1016
Scala master race.

c6c0ba No.1026

so what programs did you guys create in functional languages?

e1e004 No.1034

>>1009
>You can hardly beat functional style on code density and generic-ness, which are required for a project to scale well.
I would argue that these properties are antithetical to projects that require scale.

In order to keep things comprehensible, they must be specified in as concrete a way as possible. Additionally, the more dense something is, the more difficult it is to unpack and understand.

Functional is about the abstract and excels at abstract problems. It's absolutely wonderful for research and if you're making a modern language and *not* looking at something like Haskell or OCaml, you're flat-out wrong. There are features and ideas that are valuable regardless of your designs.

But things that require scale are almost never abstract problems.

3eb79b No.1046

>>1026
In Haskell I currently still haven't figured out how to write a "guess the number" game because the Rosetta code entry doesn't compile and I still haven't continued the effort on figuring out how to pass state recursively

3d8849 No.1047

>>1026
Technically not a 'functional language', but I'm writing a CAS in Lisp, and MOSTLY in functional style.

ed7c8d No.1074

>>1046
>how to pass state recursively
Are you using the state monad? If not, you probably should be.

33f74d No.1079

>>902
That's because it includes the runtime, compiler, garbage collector, standard library, etc.

You could probably hack up a tree shaker that undefines all unused symbols though.

e08127 No.1102

>>1079
Why wouldn't the compiler do that itself?

33f74d No.1103

>>1102
Because it doesn't make sense as a default. Would have been nice to have in the standard though.

ef4404 No.1114


8d8552 No.1127

File: 1422327005116.png (3.65 KB, 256x256, 1:1, gfx_hero old.png)

Theres Haxe + OpenFl. Its based on as3, open source, and can compile to html5 flash win lin mac.

d61d01 No.1490

File: 1424927914248.jpg (17.22 KB, 305x277, 305:277, purity.jpg)

>>1074

I've lifted myself into a monad to get that earthy FP flavor. This is how you PhD.

25eced No.1493

Where is there a good guide or book to learn about functional programming?

Why is this guide good?

Also can some one explain what exactly functional programming is and what some of its advantages are in certain applications?

Thanks

b33c3f No.1513

>>1493
SICP

050ed5 No.1524

>>1493
>Where is there a good guide or book to learn about functional programming?
LYAHFGG or whatever it's called
>Why is this guide good?
One of (if no the) best haskell books. Good for beginners.

f124dc No.1534

>>847
Look up Erlang.

cc72af No.1884

>>1024
I'm genuinely curious, why?

cc72af No.1885

>>1524
>>1493
LYAHFGG = Learn You A Haskell For Great Good, it's free on the website.

a53e16 No.1889

JavaScript is a functional programming language

67f2d1 No.1925

Haskell is a fictional programming language



[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]