Re: [Haskell-cafe] Re: Is Haskell a 5GL?
Hi, Henning Thielemann wrote: ... The notation [f x | x <- xs] describes operations on list elements, and looks like the imperative "forall x in xs do f x", whereas map f xs is a list transformation. The second one is more abstract, isn't it? for that simple example yes, but what's about list comprehensions like: sequence of parsers: (p <+> q) r = [ (f (x,y), r2) | (x, r1) <- p r, (y, r2) <- q r1 ] or triples: [ (x,y,z) | x<-[1..n], let x2=x*x, y<-[1..x], let y2=y*y, let z=isq (x2,y2), x2+y2==z*z ] or database queries: [ (name,salary) | ((_,name),dateofbirth,((Just salary))) <- table, dateofbirth>1980 && salary>10 ] I just typed these examples but did not check them. There are many other examples like n queens, functions on shaped matrices etc. Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
On Wed, 27 Sep 2006, Ch. A. Herrmann wrote: > Concerning the point someone made about the features of Haskell: > * pattern matching: just case distinction > * list comprehensions: syntactic sugar > These are indeed local syntactic issues but the amount of such small things > is essential to make things easy, in addition to semantic issues like > laziness. According to http://haskell.org/haskellwiki/History_of_Haskell two main styles of functional programming have established: "Declaration style" and "Expression style". The features you emphasize support to the declaration style. I prefer mostly the expression style and I don't feel I'm missing something important. > Assume that you do not have them: then your programs would look > as verbose as Java or LISP programs. The notation [f x | x <- xs] describes operations on list elements, and looks like the imperative "forall x in xs do f x", whereas map f xs is a list transformation. The second one is more abstract, isn't it? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
Hi, an experienced person at our lab told me that the classification into generations has become unfashioned in the last decade; thus I think I will stay away from using it but argue with concrete abstraction features. Concerning the point someone made about the features of Haskell: * pattern matching: just case distinction * list comprehensions: syntactic sugar These are indeed local syntactic issues but the amount of such small things is essential to make things easy, in addition to semantic issues like laziness. Assume that you do not have them: then your programs would look as verbose as Java or LISP programs. If someone asks me for the generation level of Haskell, I will say 5, because there are only a few small functions you have to add to implement a small theorem prover; provocatively speaking: if these were in the prelude than Haskell was an artificial intelligence language. But perhaps such marketing statements are not convincing any more. -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
Hello Max, Monday, September 25, 2006, 10:41:20 PM, you wrote: Ch>> That's a religious statement. I was looking for some strong Ch>> arguments for the nonbelievers that Haskell is a 5GL. > But what about nonbelievers in language classification by generation? i was not on the market when 1..3 GLs arrived, but i've seen 4/5 GL story and it was just marketing tool. 4gl was used to market task-specific languages embedded in some applications or used to quickly build applications, such as Clarion Database Developer. this name was used just to emphasize advantages of these laguages over general-purpose (3gl) ones in the areas that was targeted by these languages when Japan supercomputing/new programming paradigm was arrived, it was also marketed as 5 gl - not because it's superior to 4gl, but just because 4'th number was already used :) Japan project failed its goals, and logic programming don't ruled the world. but in some sense you can say that 5gl was about describing the problem instead of the way to solve it (algorithm=3gl), so FP is closer to this goal than C++ or Java -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
On Mon, 2006-09-25 at 22:22 +0200, Christoph Herrmann wrote: . . . > What Prolog really provides concerning automatic problem solving > is little: equation solving in term algebra; you can simulate that > in Haskell without much effort. On the other hand, I saw Haskell > classified as a 3GL. The problem is that Haskell often exposes > the algorithmic structure. What people often forget is that Prolog > programs in non-trivial situations are likely to fail if you do > not prescribe the evaluation order, by features like the cut which > destroy the declarative semantics. People also forget that arithmetic > constraints in Prolog have to be directed (input/output variables), > no difference to Haskell. I spent some time working on a large Prolog application where performance was critical, and it became obvious that when a Prolog program is tuned by removing non-determinism it moves towards a functional program. Any real (non-textbook example) Prolog program has to expose algorithmic details simply because the programmer must a) make decisions and b) express them. I think you're right that Haskell should be in the same bag as Prolog. -- Bill Wood ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Is Haskell a 5GL?
Max Vasin wrote: "Ch" == Ch A Herrmann <[EMAIL PROTECTED]> writes: it's a BottomthGL language :) Ch> That's a religious statement. I was looking for some strong Ch> arguments for the nonbelievers that Haskell is a 5GL. But what about nonbelievers in language classification by generation? As already mentioned you can write algorithms in Haskell (3GL), embed a DSL in it and write a program in that DSL or in several DSLs (4GL). AFAIK Mathematica is not a logic programming language, thus all its features can be implemented in Haskell as library, will be Haskell a 5GL in this case I'm looking for an honest classification. The aim of the GLs is, as I think, the degree of abstraction. The question is, how much *intelligence* provided by preprocessing, libraries etc. is permitted. Personally, I think Haskell should be a 5GL because Prolog is a 5GL. What Prolog really provides concerning automatic problem solving is little: equation solving in term algebra; you can simulate that in Haskell without much effort. On the other hand, I saw Haskell classified as a 3GL. The problem is that Haskell often exposes the algorithmic structure. What people often forget is that Prolog programs in non-trivial situations are likely to fail if you do not prescribe the evaluation order, by features like the cut which destroy the declarative semantics. People also forget that arithmetic constraints in Prolog have to be directed (input/output variables), no difference to Haskell. My argumentation is: Prolog is a 5GL & Haskell is more abstract than Prolog => Haskell is a 5GL Some of the language features in Haskell that contribute to this abstraction are: laziness, pattern matching with guards, list comprehensions, type classes Please note that this is not a philosophic discussion. If Haskell is a 3GL, than it is at the same level with Java and since Java is more common, people think they should always use Java. Haskell as a 5GL will tell people: this is a language in which you can solve problems simpler and safer and it will encourage people to try to solve problems instead of resigning due to the complexity of the problem. Cheers -- Christoph ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe