Re: [Haskell-cafe] iterative algorithms: how to do it in Haskell?

2006-08-17 Thread Tamas K Papp
On Thu, Aug 17, 2006 at 01:23:19AM -0400, [EMAIL PROTECTED] wrote: G'day all. Quoting Chris Kuklewicz [EMAIL PROTECTED]: The compiler may not deforest that list, so creating the list may be a small overhead of this method. And in return, you get: - Code that is smaller than the

Re: [Haskell-cafe] Haskell wiki: most popular pages

2006-08-17 Thread Tamas K Papp
On Thu, Aug 17, 2006 at 01:55:47AM +0400, Bulat Ziganshin wrote: Hello haskell-cafe, The http://haskell.org/haskellwiki/Special:Popularpages page lists most popular pages on haskell wiki. I think this list is very useful because it shows us what are the questions about Haskell people most

[Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Szymon Ząbkiewicz
Hi. When trying to compilke this code: {...} 8.if (a == 0) (b == 0) 9. then do 10. nr1 - read (prompt enter 1. number: ) 11. nr2 - read (prompt enter 2. number: ) 12. else do 13.let nr1 = a 14.nr2 = b {...} The compiler tells me

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Ulf Norell
On Aug 17, 2006, at 10:18 AM, Szymon Ząbkiewicz wrote: Hi. When trying to compilke this code: {...} 8.if (a == 0) (b == 0) 9. then do 10. nr1 - read (prompt enter 1. number: ) 11. nr2 - read (prompt enter 2. number: ) 12. else do 13.let nr1 =

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Matthias Fischmann
On Thu, Aug 17, 2006 at 10:18:25AM +0200, Szymon Z??bkiewicz wrote: To: haskell-cafe@haskell.org From: Szymon Z??bkiewicz [EMAIL PROTECTED] Date: Thu, 17 Aug 2006 10:18:25 +0200 Subject: [Haskell-cafe] Last statement in 'do' must be an expression error. Hi. When trying to compilke this

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Chris Kuklewicz
Szymon Ząbkiewicz wrote: Hi. When trying to compilke this code: {...} 8.if (a == 0) (b == 0) 9. then do 10. nr1 - read (prompt enter 1. number: ) 11. nr2 - read (prompt enter 2. number: ) The nr2 here is not passed to the rest of the do block started on line 9

[Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Tamas K Papp
The code in the subject generates an error. I understand why this is (- is treated as part of the number), but I don't know how to solve it, ie how to tell Haskell that - is a function/binary operator? Thanks, Tamas ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread Christian Maeder
map (\x - x - 2) [1..5] or map (flip (-) 2) [1..5] HTH Christian Tamas K Papp schrieb: The code in the subject generates an error. I understand why this is (- is treated as part of the number), but I don't know how to solve it, ie how to tell Haskell that - is a function/binary operator?

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Stefan Holdermans
Tamas, The code in the subject generates an error. I understand why this is (- is treated as part of the number), but I don't know how to solve it, ie how to tell Haskell that - is a function/binary operator? What about map (flip (-) 2) [1 .. 5] or map (+ (- 2)) [1 .. 5] ? HTH,

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread David House
On 17/08/06, Tamas K Papp [EMAIL PROTECTED] wrote: The code in the subject generates an error. I understand why this is (- is treated as part of the number), but I don't know how to solve it, ie how to tell Haskell that - is a function/binary operator? There's a Prelude function for exactly

Re[2]: [Haskell-cafe] Haskell wiki: most popular pages

2006-08-17 Thread Bulat Ziganshin
Hello Tamas, Thursday, August 17, 2006, 11:14:22 AM, you wrote: Haskell (252,505 views) Introduction (50,091 views) Libraries and tools (41,864 views) Books and tutorials (40,040 views) Language and library specification (32,773 views) Haskell in practice (31,698 views)

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Bulat Ziganshin
Hello Szymon, Thursday, August 17, 2006, 12:18:25 PM, you wrote: 8.if (a == 0) (b == 0) 9. then do 10. nr1 - read (prompt enter 1. number: ) 11. nr2 - read (prompt enter 2. number: ) 12. else do 13.let nr1 = a 14.nr2 = b

[Haskell-cafe] wxFruit with OpenGL and IO action

2006-08-17 Thread shelarcy
Hello. Sometimes, a few people are interested in wxFruit. http://zoo.cs.yale.edu/classes/cs490/03-04b/bartholomew.robinson/ But nobady knows current status of wxFruit. Over one and half year ago, I heard that students working on that ... .

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Brian Hulley
Tamas K Papp wrote: The code in the subject generates an error. I understand why this is (- is treated as part of the number), but I don't know how to solve it, ie how to tell Haskell that - is a function/binary operator? Actually looking at the Haskell98 report, -2 seems to be treated as

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Udo Stenzel
Szymon Z??bkiewicz wrote: The compiler tells me thats there's an error on line 10: The last statement in a 'do' construct must be an expression I think, you have reached the point where treating do-notation as magic won't help you. Remember, do nr1 - read (prompt enter 1. number: )

[Haskell-cafe] Re: Samba/FTP bindings

2006-08-17 Thread John Goerzen
On 2006-08-16, Ivan Tarasov [EMAIL PROTECTED] wrote: Is there some Haskell library which provides Samba bindings and some FTP client library bindings (e.g. ftplib3)? MissingH provides a pure-Haskell FTP client (and server!) implementation. -- John

Re[2]: [Haskell-cafe] Haskell wiki: most popular pages

2006-08-17 Thread Bulat Ziganshin
Hello Tamas, Thursday, August 17, 2006, 2:29:26 PM, you wrote: The link from http://haskell.org/haskellwiki/Learning (to http://www.cs.uu.nl/~afie/haskell/tourofprelude.html) is dead, so is the one from Books_and_Tutorials. thank you. i have fixed both. btw, you can register himself on the

[Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread Stefan Monnier
I'd have thought it would have been simpler to just make the rule that -2 (no spaces between '-' and '2') would be a single lexeme, But then x-2 won't mean subtract 2 from x but call x with arg -2. Stefan ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Jared Updike
I'd have thought it would have been simpler to just make the rule that -2 (no spaces between '-' and '2') would be a single lexeme I'd have thought so too, until I implemented a parser with exponentiation. It is easy to get confused and make a parser that is too eager to include the minus sign

[Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread Jón Fairbairn
Stefan Monnier [EMAIL PROTECTED] writes: I'd have thought it would have been simpler to just make the rule that -2 (no spaces between '-' and '2') would be a single lexeme, But then x-2 won't mean subtract 2 from x but call x with arg -2. Well, since the normal typographical convention

[Haskell-cafe] Description of Haskell extensions used by FPTOOLS

2006-08-17 Thread Brian Smith
Is there any design document for the FPTOOLS libraries or some description of language features that are (allowed to be) used in them?I am going to be taking some significant time off from my normal jobs in the upcoming months. During part of that time, I would like to do some work to improve the

[Haskell-cafe] A restricted subset of CPP included in a revision of Haskell 98

2006-08-17 Thread Brian Smith
Hi, I find it strange that right now almost every Haskell program directly or indirectly (through FPTOOLS) depends on CPP, yet there is no effort to replace CPP with something better or standardize its usage in Haskell. According to the following document, and my own limited experience in reading

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread John Meacham
On Thu, Aug 17, 2006 at 11:14:32AM +0100, Brian Hulley wrote: I'd have thought it would have been simpler to just make the rule that -2 (no spaces between '-' and '2') would be a single lexeme, and then people could just use (negate x) or (0 - x) instead of having a special rule and a whole

Re: [Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread John Meacham
On Thu, Aug 17, 2006 at 11:18:59AM -0400, Stefan Monnier wrote: I'd have thought it would have been simpler to just make the rule that -2 (no spaces between '-' and '2') would be a single lexeme, But then x-2 won't mean subtract 2 from x but call x with arg -2. but now at least a

Re: [Haskell-cafe] A restricted subset of CPP included in a revision of Haskell 98

2006-08-17 Thread Brian Smith
On 8/17/06, John Meacham [EMAIL PROTECTED] wrote: On Thu, Aug 17, 2006 at 11:44:17AM -0500, Brian Smith wrote: Hi, I find it strange that right now almost every Haskell program directly or indirectly (through FPTOOLS) depends on CPP, yet there is no effort to replace CPP with something better or

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Brian Hulley
Jared Updike wrote: -4^2is not the same whether parsed as (-4)^2 or -(4^2) (the correct version) Basically, before someone argues this with me, -4^2 should parse the same as - 4^2 which should be the same thing as 0 - 4^2 I'd argue that -4^2 should parse as (-4)^2 in the same way

[Haskell-cafe] More threading confusion

2006-08-17 Thread Creighton Hogg
Good afternoon Haskellers,So I'm trying to understand how STM works, and wrote a quick 'eating philosophers' example to see if I understood how it's supposed to work.The problem is that while it executes, it doesn't appear to *do* anything. Did I completely write things wrongheadedly or am I being

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread David House
On 17/08/06, Brian Hulley [EMAIL PROTECTED] wrote: Literal highlighting in the editor would make it clear that x-2 === x (-2). I think a basic issue is that at the moment it is strange that non-negative numbers can be specified as literals but negative numbers can't - they can only get in

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Jared Updike
I'd also argue that in maths the necessary brackets are implied by the superscripting syntax ASCII text parsing issues aside, in math, 2 -4 =? (No you cannot ask if there is space between the 4 and the - symbol, or if I meant (-4)^2 or -(4^2), or if I wrote a negative sign

Re: [Haskell-cafe] A restricted subset of CPP included in a revisionof Haskell 98

2006-08-17 Thread Brian Hulley
On Thursday, August 17, 2006 7:54 PM, Brian Smith wrote: I want to have conditionals limited in their placement to make things easier for refactoring tools. But, I don't have any ideas about how to deal with conditional exports without allowing preprocessor conditionals in the export list.

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Brian Hulley
Jared Updike wrote: I'd also argue that in maths the necessary brackets are implied by the superscripting syntax ASCII text parsing issues aside, in math, 2 -4 =? (No you cannot ask if there is space between the 4 and the - symbol, or if I meant (-4)^2 or -(4^2), or if I

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Brian Hulley
David House wrote: On 17/08/06, Brian Hulley [EMAIL PROTECTED] wrote: Literal highlighting in the editor would make it clear that x-2 === x (-2). I think a basic issue is that at the moment it is strange that non-negative numbers can be specified as literals but negative numbers can't - they

Re: [Haskell-cafe] More threading confusion

2006-08-17 Thread Chris Kuklewicz
Creighton Hogg wrote: Good afternoon Haskellers, So I'm trying to understand how STM works, and wrote a quick 'eating philosophers' example to see if I understood how it's supposed to work. The problem is that while it executes, it doesn't appear to *do* anything. Did I completely write

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Jared Updike
Yes but my point is that -4^2 is not the same as 2 -4 because the latter by convention means - (4^2). In other words, superscripts bind tighter than prefix ops but prefix ops bind tighter than infix. I see. My point is that there already exists a convention[1]

Re: [Haskell-cafe] A restricted subset of CPP included in a revision of Haskell 98

2006-08-17 Thread Donald Bruce Stewart
brianlsmith: Hi, I find it strange that right now almost every Haskell program directly or indirectly (through FPTOOLS) depends on CPP, yet there is no effort to replace CPP with something better or standardize its usage in Haskell. According to the Note also cpphs,

Re: [Haskell-cafe] Description of Haskell extensions used by FPTOOLS

2006-08-17 Thread Donald Bruce Stewart
brianlsmith: Is there any design document for the FPTOOLS libraries or some description of language features that are (allowed to be) used in them? There's a list of extensions used at the bottom of this page: http://hackage.haskell.org/trac/haskell-prime/wiki/HaskellExtensions

Re: [Haskell-cafe] A restricted subset of CPP included in a revision of Haskell 98

2006-08-17 Thread Lennart Augustsson
Even though I'm largely responsible for making CPP available in a Haskell compiler I think it's an abomination. It should be avoided. If we standardize it, people will use it even more. I think we should discourage it instead, then looking at exactly what it's used for and supplying sane

Re: [Haskell-cafe] A restricted subset of CPP included in a revisionof Haskell 98

2006-08-17 Thread Lennart Augustsson
On Aug 17, 2006, at 17:11 , Brian Hulley wrote: On Thursday, August 17, 2006 7:54 PM, Brian Smith wrote: I want to have conditionals limited in their placement to make things easier for refactoring tools. But, I don't have any ideas about how to deal with conditional exports without

[Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-17 Thread John Meacham
On Tue, Aug 15, 2006 at 08:36:28PM +0200, Gabriel Dos Reis wrote: Roughly Haskell type classes correspond to parameterized abstract classes in C++ (i.e. class templates with virtual functions representing the operations). Instance declarations correspond to derivation and implementations of

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread John Meacham
On Fri, Aug 18, 2006 at 12:20:54AM +0100, Brian Hulley wrote: data Integer = ... | -1 | 0 | 1 | ... tells me that the negative and positive integers are on an equal footing. Ie the language is sending out a mixed message about the integers, which is confusing. Not only that but there

Re: [Haskell-cafe] map (-2) [1..5]

2006-08-17 Thread Brian Hulley
Jared Updike wrote: In other words, superscripts bind tighter than prefix ops but prefix ops bind tighter than infix. I see. My point is that there already exists a convention[1] that the way to type in 2 -4 is -4^2 which means -(4^2) not (-4)^2 because - as a prefix op has the same

Re: [Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

2006-08-17 Thread Thomas Conway
On 8/18/06, John Meacham [EMAIL PROTECTED] wrote: [lots of good argument before and after deleted] There is a major difference though, in C++ (or java, or sather, or c#, etc..) the dictionary is always attached to the value, the actual class data type you pass around. in haskell, the

[Haskell-cafe] HaXml question

2006-08-17 Thread Tim Newsham
I thought this one would be easy but I'm starting to think its not. I am playing with HaXml and I want to transform an XML tree into another tree. The transforms are simple enough, but the kicker is that I want them to be stateful. In this example, the state is a random number generator. So