News for hackers. Stuff that matters.
Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @06:23AM (#6190606)
Having programmed at least 10k locs in all major paradigms, I've come to the conclusion that relational programming (prolog and sql) are the best. Haskell talks a good game and a lot of OO procedural code has been written, but for programming succinct, elegant code, which also happens to be the most lucrative - sql databases underlying most business - the relational paradigm cannot be beat.

It's the most beautiful invention of computer science, Programming in prolog, especially, is the closest a programmer can come to achieving a state of nirvana. A place where the mind is at one with the problem at hand.

Re:Why functional programming? Why Haskell? by jacquesm on Saturday August 10, 2013 @06:38AM (#6190633)
Good luck controlling your ABS system using prolog.

Having programmed more than I care to remember (since we're establishing credibility by tossing unverifiable facts in there) I think it takes the right tool for the right job. Sometimes that's prolog, sometimes that's assembly and sometimes it's something else entirely.

Every language that is in use today has a niche, no single language manages to span more than a few such niches and the larger the impedance mismatch between the problem and the language the more work you have to do.

Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @06:59AM (#6190662)
Prolog can be used in embedded systems http://www.hercsmusicsystems.com/
Re:Why functional programming? Why Haskell? by jacquesm on Saturday August 10, 2013 @08:01AM (#6190774)
Embedded and hard real time are not the same thing.
Re:Why functional programming? Why Haskell? by tome on Saturday August 10, 2013 @06:50AM (#6190652)
Relational programming is indeed excellent, but how can you put up with writing in SQL? Of all the programming languages I've ever used, it's the one that allows the least abstraction.
Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @07:15AM (#6190690)
Abstraction in sql are views, done with left joins (rules in prolog). It doesn't seem like much, but that's the beauty of of it, you only need one concept and that's all you need. Contrast that with other languages where you have hundreds of little functions.
Re:Why functional programming? Why Haskell? by tome on Saturday August 10, 2013 @07:25AM (#6190712)
Not all abstractions are relations though. In SQL can you abstract the functionality of "take a relation with one int column, one string column, one double column, sum the int column, group by the string column and average the double column"?

Do views support the notion of primary keys and foreign keys?

I wouldn't be able to program in SQL without the former, and the latter would also be useful.

Re:Why functional programming? Why Haskell? by rbanffy on Saturday August 10, 2013 @11:36AM (#6191405)
> Having programmed at least 10k locs in all major paradigms

I don't want to sound insulting, but 10 KLOC is not nearly enough to get a reasonable understanding of even very concise languages. 10 KLOCs of APL, maybe, but certainly not with C, Java (certainly not with Java) or even Ruby or Python.

Beware of Maslow's hammer.

Re:Why functional programming? Why Haskell? by VMG on Saturday August 10, 2013 @06:27AM (#6190614)
Why do you think aren't those languages more popular?
Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @06:46AM (#6190644)
Sql is extremely popular, that's the LAMP stack. Rails and Django led people astray for a while but that's ending.

Prolog should be more popular, it should be at least embedded in every program, even in the browser.

If there are more than a few for loops or if else statements than the majority of the program should be encoded in sql/prolog.

If you look at all these javascript frameworks, the core concept they're missing is relational programming. The program should be a loop that takes all input events like mouse clicks, etc. and then queries a prolog engine about to what actions to take.

It's getting more popular steadily. Map/reduce is being replaced/complemented with distributed sql, and the frontend will also come around as people starting embedding prolog into their guis (LAMP stack in the browser).

Re:Why functional programming? Why Haskell? by helloTree on Saturday August 10, 2013 @07:09AM (#6190677)
Do you know of any major prolog programs that are in use and where you think that they really are successful because of prolog's strengths? I did a little bit of prolog in a logic course, but it never felt natural to me compared to functionl programming. But of course, maybe that's just because I did not dive into it and there are people who think FP feels unnatural. However I really would like to see some real world software in it (with "real world" I mean no AI system, planning system or inference system, but something very small, e.g. a web server, a text editor, a graphics engine, a synthesizer, an operating system, etc.)
Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @07:22AM (#6190708)
The semantics of sql and prolog are the same, so in one sense it's everywhere - relational databases. Prolog specifically is not commonplace because historically the gui's have been written with OO and then the web came and frontend was stateless (html pages sent to browser). As gwt-style single page apps become popular again, hopefully this time prolog will replace OO.
Re:Why functional programming? Why Haskell? by tome on Saturday August 10, 2013 @07:26AM (#6190713)
I'm rather uninitiated into all this. What's your basis for claiming the semantics are the same? Isn't backtracking present in Prolog and absent in SQL?
Re:Why functional programming? Why Haskell? by unono on Saturday August 10, 2013 @07:39AM (#6190733)
There's a good stackoverflow answer on that http://stackoverflow.com/questions/2117651/difference-betwee...
Re:Why functional programming? Why Haskell? by tome on Saturday August 10, 2013 @07:42AM (#6190736)
That looks super. Thank you!