Advanced Search
Welcome to Omgili,
Omgili (Oh My God I Love It ;) is a search engine for discussions. With Omgili you can find answers and solutions, debates, discussions, personal experiences, opinions and more... To learn more about Omgili click here.

This is a complete preview of the discussion as it was indexed by Omgili crawlers. Use this preview if the original discussion is unavailable.
Click here to view the original discussion.

The Promises of Functional Programming (with Clojure examples) [PDF] : programming

A place for all things programming. Before making a self-post in /r/programming, please check the programming.reddit FAQ to see if it's there first We're toying with the idea of blocking this reddit from advertisers and replacing the 300x250 ad unit with our redditjobs widget so you'll see new jobs instead of advertisements. Check out our jobs board .

In other words: trust us, it will be useful someday (but not yet).

You guys mod me down but it's true.

Advantages of FP for parallelization haven't been shown to be worth shit.

Oh really? Even in your favourite language that you don't seem to know very well?

I don't know Java very well, but I do know it better than people who think that == not being the same as equals is something perplexing and indicative of a need for a paradigm shift about the nature of the programming language universe.

I also (lamentably) think I should learn proper C++ for my pet projects, since I just can't ignore the performance advantages. But anyway...

I've never seen that Functional Java library before.

What's up with that curly brace convention though?

And, Fibonacci numbers, really?

How hard would it be to write an imperative parallel version of similar complexity that also uses multiple cores well?

(Never mind that calculating Fibonacci numbers using the definition directly is, a priori, beyond retarded.) Edit: Also, providing an exponentially scaling sequential function?

That's just an indication of brain damage.

At least use memoization there.

Whoosh

I'm not smart enough for how funny you are I guess.

You win this time...

If there ever was a competiton I lost.

I tried though.

So, you dont know Java very well, nor do you know 'proper c++', AND you're obviously not into functional programming what language do you use???

(PHP ?? )

PHP is probably my strongest language right now, since I write it for a living.

Followed by Java, followed by probably Objective C and C.

In other words, yes I really am just some noob, but it's still funny that what I say about functional programming seems to be true.

(I get plenty of downvotes, but what I never get is a reasonable refutation.)

I wonder which one is faster: parallel recursive or iterative Fibonacci?

It's a naive solution in any case.

That's a funny comment.

I wrote a ray tracer for my functional programming class and, by adding 53 characters (changing a map to a parallel version and importing the relevant library) and recompiling, got a 40% speedup due to parallelization. I obviously deliberately chose something close to a pathological case, but that's still difficult numbers to ignore as "not yet useful".

Especially since I'm still in the early stages of learning Haskell. Update: Commentary and code available here .

Topic-relevant reddit posting available here

Ray tracing natually lends itself to paralellization.

If you want it on four cores, you split up the screen into four sections and run one on each. Showing functional programming was worth anything here would require problems where this is not so easy in imperative languages.

(I don't even know why this obvious fact needs stating.)

Read this post by Clojure's author in response to somebody on comp.lang.lisp claiming they "ported" his ants colony demo to Common Lisp: http://groups.google.com/group/comp.lang.lisp/msg/a86c91091ae16970

My point wasn't how well the topic lends itself to parallelization, it's how easy it was to make it happen.

This would also be dead easy using OpenMP in an imperative language.

Nice how he got my-reduce totally wrong

Why? I don't see the mistake.

I think Clojure doesn't directly support optimizing tail-recursion.

While optimizing continuations aren't supported in the JVM, the recur special form handles the common case of tail self-recursion.

There's also trampoline for the complex cases.

You can also obviate the need a bit by using fully-lazy sequences.

He needs to use the recur special form, that's all. EDIT: I should have added here that I recognize the name of one of the authors from the clojure mailing list, and he would not make a 'mistake' like this, it could only be a decision to avoid burdening his readers with the tedious details of clojure working around jvm limitations.

The article is an introduction to functional programming using Clojure for examples.

It is not about optimizing tail recursion in Clojure!

I know about recur, I use it in my real code, but I don't want to explain this to people who are just finding out how recursion works!

I am in total agreement with you.

My comment that you replied to was trying to explain what it was that people were complaining about, but using wording that minimized the significance of the 'mistake' (which wasn't one, of course), apparently I did not do well enough.

Please note I wasn't the one calling your example 'totally wrong'.

For the record I think dupin's complaint was lame and I downmodded it. Good article, btw.

The formatting of that pdf is horrible, why did they put it into three narrow columns?