[Haskell-cafe] Re: Is Haskell a 5GL?
On Thu, 5 Oct 2006, Ch. A. Herrmann wrote: 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 = [ ((x,y), r2) | (x, r1) - p r, (y, r2) - q r1 ] More abstract: p + q = runStateT (liftM2 (,) (StateT p) (StateT q)) If you give the parsers the StateT type, then it is even + = liftM2 (,) 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 ] This is rather a 1:1 translation of an imperative program, a bit shorter, ok, but it will certainly not impress an imperative programmer. I find it more important that the generation of pairs, where the first element is smaller than the second one, can be nicely separated from the Pythagoras check, due to laziness. ___ 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, 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, dateofbirth1980 salary10 ] 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[2]: [Haskell-cafe] Re: Is Haskell a 5GL?
Hello Ch., Wednesday, September 27, 2006, 7:31:00 PM, you wrote: 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 some time i will write Haskell advertisement wiki. key Haskell selling points i plan to mention is its expressiveness, reliability, excellent support for concurrency while higher-order funcs, parameterized ADTs, polymorphism, laziness, immutable data and various other language features are just concrete Haskell instruments that allow to reach these universal programmers goals meanwhile, i recommend you to look into why Haskell matters and http://www.md.chalmers.se/~rjmh/Papers/whyfp.pdf -- 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?
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[2]: [Haskell-cafe] Re: Is Haskell a 5GL?
Hello Bill, Tuesday, September 26, 2006, 1:03:02 AM, you wrote: I spent some time working on a large Prolog application where performance was critical, ... I think you're right that Haskell should be in the same bag as Prolog. and Haskell is the same as C++ when performance is critical, while C++ is the same as assembler. believe me - i has experience of optimizing both Haskell and C++ programs :) i think it's wrong to make decisions about language expressiveness on the base of requirements for writing optimized programs. my _application_ Haskell/C++ code contains about 80-90%% of code that _don't need_ to be optimized and it's just the case when higher language expressiveness rules. but for the remaining 10-20%% optimizing of higher-level language becomes a nightmare and it is much better to use lower-level language in these places (if it's possible!) instead of using lower-level techniques that just don't fit in the higher-language toolbox :( ps: btw, i was really thinking in assembler when optimizing my Haskell lib. it is why it so fast. on good-old DEC cpus whole getChar/putChar actions may be compiled in just one asm instruction :) so, using your logic, Haskell is 1-gl language :) -- 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?
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
[Haskell-cafe] Re: Is Haskell a 5GL?
On Mon, 25 Sep 2006, Christoph Herrmann wrote: 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. Compare Haskell with Computer algebra systems, where you can write root equations, and the system tells you the set of solutions. CAS let you write some infinite sum or integral, things that cannot be solved by brute force, and the system simplifies that to a fraction of pi or so. This is non-trivial and you would have to program a lot in Haskell to achieve this. My argumentation is: Prolog is a 5GL Haskell is more abstract than Prolog = Haskell is a 5GL Or Prolog is better classified as 3GL. :-) Some of the language features in Haskell that contribute to this abstraction are: laziness, pattern matching with guards, list comprehensions, type classes Pattern matching with guards is not more than a 'switch', list comprehension is syntactic sugar, some type relations are available in all OO languages. What remains special is laziness, higher order functions. (Did I forget something?) Indeed, these features allow for more abstraction. Maybe we could classify Haskell as 3.5 GL or so. :-) 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. So classification is a marketing issue? A higher level of abstraction can also scare people, if they expect efficiency. I also know Java freaks who stay away from Haskell, because they find it too abstract. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Haskell vs Prolog was [Haskell-cafe] Re: Is Haskell a 5GL?
Here is a paper on how to do logic programming in Haskell Deals with a logic puzzle and how the haskell and prolog solutions compare http://web.engr.oregonstate.edu/~erwig/zurg/ In terms of automated theorem proving here is another paper http://citeseer.ist.psu.edu/cache/papers/cs/5363/http:zSzzSzwww.ki.informatik.uni-frankfurt.dezSz~panitzzSzpaperzSzrussian.pdf/theorem-proving-in-a.pdf Regards David On 26/09/06, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:haskell-cafe- [EMAIL PROTECTED] On Behalf Of Christoph Herrmann Sent: 25 September 2006 21:22 To: Max Vasin Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: Is Haskell 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. Could you, or anyone else, elaborate a bit on how to emulate Prolog in Haskell? For example, I remember that in Prolog you can write a concat function that can be used to concatenate two lists as well as to split them: concat([1,2] ,[3,4] ,Z) -- Z = [1,2,3,4] concat([1,2] ,Y ,[1,2,3,4]) -- Y = [3,4] Now, that's powerful. How would you do that in Haskell? Regards, Titto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- It chews up lies and spits out the gristle of truth http://liveatthewitchtrials.blogeasy.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Is Haskell a 5GL?
Ch == Ch A Herrmann [EMAIL PROTECTED] writes: Ch Hi, Hello, I'd say very strong, lots of times a where is used thats making use of laziness. Ch I don't agree: where is often only used to program in a top-down Ch style I would say in a more declarative style, the where is closer to thinking of the program as a set of equations (as opposed to let). -- WBR, Max Vasin. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Is Haskell a 5GL?
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? -- WBR, Max Vasin. ___ 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
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