Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, Aug 2, 2009 at 12:25 PM, Petr Pudlak d...@pudlak.name wrote: I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. (2) They are using logic programming already (Prolog); why is Haskell better than Prolog (or generally a functional language better than a logic programming language)? Regarding (1), today it's common to do functional programming in industrially accepted languages, at least if you want to be productive :) Take for example the following C# code, taken from production code: var graphs = selection.SelectMany( e = e.SelfAndIntraGraphAncestors() .OfTypeIGraphContainer() .Take(1) .SelectMany(gc = gc.ChildGraphs)); Each of these C# methods work on lazy streams, so this even lazy functional programming in a sense :) (albeit with potential side effects) I could write this in imperative style, something like this (but it's not the same, the code below is strict, a lazy version would be much longer, unless I cheat and use C#'s yield statement) var graphContainers = new ListIGraphContainer(); foreach( var entity in selection ) { foreach( var ancestor in entity.SelfAndIntraGraphAncestors() ) { var graphContainer = ancestor as IGraphContainer; if( graphContainer != null ) { foreach( var childGraph in graphContainer.ChildGraphs ) { graphContainers.Add(childGraph); } break; } } } Obviously the second one is much less declarative and more difficult to read (and maintain). So really, any good industrial programmer should master at least the basics of functional programming. Haskell might be one of the most beautiful and elegant languages to use for learning functional programming. Also IMHO any experienced programmer should understand that although popular imperative programming languages like C++, C#, Java, Python, etc are more powerful than pure functional languages (in these sense that you can peek and poke around without restrictions like a crazy chicken), in practice this power is so difficult to control that it's a bit like giving everybody the right to carry a gun in public so people would feel safer ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Mon, 2009-08-03 at 00:24 +0400, Bulat Ziganshin wrote: . . . and the primary way to make haskell program faster is to emulate imperative language. and the best way to optimize C program is to use it as cpu-independent assembler. it's all natural in von-Neumann world and i personally don't buy these as arguments against everything developed since 1956 actually it supports their's POV: LP is an FP plus non-determinism so why buy a part instead of whole thing? if they need to teach students how to optimize programs, Haskell will be out of luck anyway This seems largely tangential to my point, which was that logic programmers can well benefit from exposure to functional programming since 1) one important approach to improving the performance of logic programs is reduction of non-determinism, and 2) often times a deterministic logic program is very similar to a functional program. -- Bill Wood ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Fwd: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
The middle road could be Curry http://en.wikipedia.org/wiki/Curry, sorry, this Curry http://www.informatik.uni-kiel.de/~curry/, a functional-logic language. I know that curry has gained a lot of interest from prolog programmers. There are compilers from Curry to Prolog. It is a haskell 98 implementation (more or less) with all logic programming features. It can be seen also as a logic language with haskell syntax. Therefore, its syntax is more mathematical, rather that the ugly clause-based syntax of Prolog, that is at odds with anything except with pure aristothelian logic. 2009/8/2 Thomas ten Cate ttenc...@gmail.com On Sun, Aug 2, 2009 at 12:25, Petr Pudlakd...@pudlak.name wrote: Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. Which, even if it were true, is an argument *for* instead of *against* teaching it at a university; that is what the word academic means, after all... Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
are you a student (undergrad or grad) or faculty (junior or senior)? These are all very different scenarios and accordingly different goals are realistic. For example, if you're a student, it might be more realistic to start with finding a professor who will be willing to supervise an independent study class. On Sun, Aug 2, 2009 at 6:25 AM, Petr Pudlak d...@pudlak.name wrote: Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. (2) They are using logic programming already (Prolog); why is Haskell better than Prolog (or generally a functional language better than a logic programming language)? (1) is easier to answer, there are a lots of applications at HaskellWiki, or elsewhere around the Internet, written in Haskell, OCaml, etc. Still, I welcome comments on your experience, for example, if you have written some larger-scale application in Haskell (or another a functional language) that is not at HaskellWiki, and perhaps if/why you would recommend doing so to other people. (2) is harder for me, since I've never programmed in Prolog or another language for logic programming. I'd be happy if anyone who is experienced in both Prolog and Haskell could elaborate the differences, pros cons etc. Thanks, Petr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, Aug 02, 2009 at 08:36:27AM -0400, Carter Schonwald wrote: are you a student (undergrad or grad) or faculty (junior or senior)? These are all very different scenarios and accordingly different goals are realistic. I'm a faculty member (postdoc). I've been working in the field of automated theorem proving, but for about a year I'm also very interested in Haskell and in general in the theory behind functional languages. Since I find FP to be a very important programming concept, I'd like to achieve that we start teaching it at the university. Petr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
Have you considered say proposing a class on theorem proving that uses coq? www.*coq*.inria.fr http://www.coq.inria.fr . Such a class would entail teaching how to program using the coq term language, which is itself a pure functional language, albeit one with some restrictions related to everything impure. As a matter of course in such a class you would naturally also mention that there are languages such as haskell which lack such restrictions/ have clever ways around them. -Carter On Sun, Aug 2, 2009 at 8:52 AM, Petr Pudlak d...@pudlak.name wrote: On Sun, Aug 02, 2009 at 08:36:27AM -0400, Carter Schonwald wrote: are you a student (undergrad or grad) or faculty (junior or senior)? These are all very different scenarios and accordingly different goals are realistic. I'm a faculty member (postdoc). I've been working in the field of automated theorem proving, but for about a year I'm also very interested in Haskell and in general in the theory behind functional languages. Since I find FP to be a very important programming concept, I'd like to achieve that we start teaching it at the university. Petr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
That's actually a good idea. I haven't considered this alternative so far, probably because I have always been working with first-order theorem provers. But I guess eventually I'll merge my interests in ATP and FP and start doing some serious work with higher-order theorem provers like coq or Isabelle. Petr On Sun, Aug 02, 2009 at 09:03:14AM -0400, Carter Schonwald wrote: Have you considered say proposing a class on theorem proving that uses coq? www.coq.inria.fr . Such a class would entail teaching how to program using the coq term language, which is itself a pure functional language, albeit one with some restrictions related to everything impure. As a matter of course in such a class you would naturally also mention that there are languages such as haskell which lack such restrictions/ have clever ways around them. -Carter On Sun, Aug 2, 2009 at 8:52 AM, Petr Pudlak d...@pudlak.name wrote: I'm a faculty member (postdoc). I've been working in the field of automated theorem proving, but for about a year I'm also very interested in Haskell and in general in the theory behind functional languages. Since I find FP to be a very important programming concept, I'd like to achieve that we start teaching it at the university. Petr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, Aug 2, 2009 at 12:25, Petr Pudlakd...@pudlak.name wrote: Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. Which, even if it were true, is an argument *for* instead of *against* teaching it at a university; that is what the word academic means, after all... Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, 2009-08-02 at 12:25 +0200, Petr Pudlak wrote: (2) is harder for me, since I've never programmed in Prolog or another language for logic programming. I'd be happy if anyone who is experienced in both Prolog and Haskell could elaborate the differences, pros cons etc. I have done some real-world programming in Prolog and SML. The conventional wisdom in the LP community seems to be that the primary path to performance improvement of logic programs is by reduction of non-determinism. To a first approximation, when you have eliminated all the non-determinism from a logic program what you have left is a functional program. The work I was involved with, trying to get quasi-real-time performance from Prolog, bore this out. -- Bill Wood ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
Hello Bill, Monday, August 3, 2009, 12:01:27 AM, you wrote: I have done some real-world programming in Prolog and SML. The conventional wisdom in the LP community seems to be that the primary path to performance improvement of logic programs is by reduction of non-determinism. and the primary way to make haskell program faster is to emulate imperative language. and the best way to optimize C program is to use it as cpu-independent assembler. it's all natural in von-Neumann world and i personally don't buy these as arguments against everything developed since 1956 actually it supports their's POV: LP is an FP plus non-determinism so why buy a part instead of whole thing? if they need to teach students how to optimize programs, Haskell will be out of luck anyway -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, Aug 2, 2009 at 6:25 AM, Petr Pudlak d...@pudlak.name wrote: Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. (2) They are using logic programming already (Prolog); why is Haskell better than Prolog (or generally a functional language better than a logic programming language)? Why can't a language be both? Get them to take a look at Mercury, which is *both* a logic programming language *and* a (strict) functional programming language, with Haskell-style type-classes and Clean-style uniqueness types. Mercury has been described as Prolog for serious software engineers. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
I would have thought that a major motivation for the study of haskell,or for that matter ML, Clean, would be their type systems: statically typed higher order parametric polymorphism which is certainlly different enough from that of prolog to warrant study. So from the perspective of type systems and associated gaurantees functional programming languages probably represent the best environment in which to study these concepts. - Original Message - From: Petr Pudlak d...@pudlak.name To: Haskell Cafe haskell-cafe@haskell.org Sent: Sunday, August 02, 2009 8:25 PM Subject: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. (2) They are using logic programming already (Prolog); why is Haskell better than Prolog (or generally a functional language better than a logic programming language)? (1) is easier to answer, there are a lots of applications at HaskellWiki, or elsewhere around the Internet, written in Haskell, OCaml, etc. Still, I welcome comments on your experience, for example, if you have written some larger-scale application in Haskell (or another a functional language) that is not at HaskellWiki, and perhaps if/why you would recommend doing so to other people. (2) is harder for me, since I've never programmed in Prolog or another language for logic programming. I'd be happy if anyone who is experienced in both Prolog and Haskell could elaborate the differences, pros cons etc. Thanks, Petr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe