Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-23 Thread Xavier Noria
You people rock. Responses were really helpful and I understand how the computation goes now. I see I need to reprogram my eyes to expect lazy evaluation in places where I am used to one-shot results. I see lazy evaluation is all around in Haskell builtins. From a formal point of view

Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-23 Thread Bulat Ziganshin
Hello Xavier, Thursday, August 23, 2007, 3:08:25 AM, you wrote: I am learning Haskell with Programming in Haskell (an excellent book BTW). scheme of lazy evaluation called graph reduction you may consider it as repetitive replacing right parts of function definitions with their left parts.

Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-23 Thread Malte Milatz
Stefan O'Rear wrote: As is usual for mathematical things, there are many equivalent definitions. My two favorites are: 1. Normal order reduction In the λ-calculus, lazy evaluation can be defined as the (unique up to always giving the same answer) evaluation method, which, if *any*

[Haskell-cafe] Re: help understanding lazy evaluation

2007-08-23 Thread Jon Fairbairn
Stefan O'Rear [EMAIL PROTECTED] writes: Indeed, you've caught on an important technical distinction. Lazy: Always evaluating left-outermost-first. I think most people would rather use the term normal order¨ for that; lazy means evaluating in normal order /and/ not evaluating the same

Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Isaac Dupree
Hugh Perkins wrote: On 8/22/07, Twan van Laarhoven [EMAIL PROTECTED] wrote: But Double is already quite badly behaved: let x = 1e20 Prelude 1 + (x - x) 1.0 Prelude (1 + x) - x 0.0 E. Whilst that's understandable and unavoidable, that kindof rings alarm bells for folds of

Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-23 Thread Ronald Guida
I'm trying to understand lazy evaluation as well. I created an example for myself and I'm wondering if I've got it right. let adder n = \x - n + x in (map (adder 12) [1,2,3]) !! 1 So the first thing I did is draw a graph to represent my expression. (map (adder 12) [1,2,3]) !! 1 =

Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Neil Mitchell
Hi Its (==) isn't reflexive (is it transitive? probably, at least if there aren't too many optimizations, but floating-point transitive equality isn't very useful). It's not even referentially transparent in all cases. a == b may fail while the double's are in the high precision registers,

Re: [Haskell-cafe] Tackling IO (the correct way)

2007-08-23 Thread Isaac Dupree
Dave Tapley wrote: Hi again all, I could do with some design pointers for a project I'm working on combining Haskell with a robot. My situation is: I read sensor data from the robot lazily a line at a time, as soon as a line is read in my code sends out a response down a pipe. Implemented in

[Haskell-cafe] Ann: Gtk2Hs Tutorial Port

2007-08-23 Thread Hans van Thiel
Hello All, I've already announced this on the Gtk2Hs users' list, but for those who are not using Gtk2Hs at the moment, but who might be interested: I've started a port of the Gtk+2.0 tutorial by Tony Gail and Ian Main and the first part is available on:

Re[2]: [Haskell-cafe] Tackling IO (the correct way)

2007-08-23 Thread Bulat Ziganshin
Hello Isaac, Thursday, August 23, 2007, 4:17:52 PM, you wrote: Using IORefs in two different threads probably needs MVars [1] or TVars no documentation where it should be: the best documentation still is Tackling the awkward squad: monadic input/output, concurrency, exceptions, and

[Haskell-cafe] Re: Newbie question: Where is StackOverflow on the Wiki?

2007-08-23 Thread apfelmus
Neil Mitchell wrote: sum (enum 1 10) = sum' 0 (enum 1 10) = ... sum' 36 (9 : enum (9+1) 10) = (sum' $! (36+9)) (enum (9+1) 10) = sum' 45 (enum (9+1) 10) = sum' 45 [] = 45 (I need to find some way to automate making these trails

[Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-23 Thread Andrew Coppin
apfelmus wrote: Yeah, the precise details may vary, even :) But for teaching, an automatic tool that does graph reduction would be great. I don't mind if it's sloppy (directly apply definitions pattern matching VS everything is a lambda abstraction) and only does simply typed lambda calculus

Re: [Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-23 Thread Neil Mitchell
Hi Yeah, the precise details may vary, even :) But for teaching, an automatic tool that does graph reduction would be great. I don't mind if it's sloppy (directly apply definitions pattern matching VS everything is a lambda abstraction) and only does simply typed lambda calculus (no

[Haskell-cafe] Re: help understanding lazy evaluation

2007-08-23 Thread apfelmus
Ronald Guida wrote: Can anyone tell me if I've got this right? Yes, you got. The let-statement you introduce that embodies the sharing of the argument n = 12 probably should be present in the first parts, too. But this doesn't really matter, the formalities of graph reduction vary with the

Re: [Haskell-cafe] Re: Newbie question: Where is StackOverflow on the Wiki?

2007-08-23 Thread Peter Verswyvelen
I think DrScheme does that for Scheme. So a must have for Haskell! Maybe could be added to the Helium project? - Oorspronkelijk bericht - Van: apfelmus [mailto:[EMAIL PROTECTED] Verzonden: donderdag, augustus 23, 2007 08:00 PM Aan: haskell-cafe@haskell.org Onderwerp: [Haskell-cafe] Re:

[Haskell-cafe] Bug in Gtk2HS 0.9.12/SOE on WinXP? Or is it just me?

2007-08-23 Thread Peter Verswyvelen
First of all, I'm really excited that GTK2HS 0.9.12 now allows launching SOE apps using GHCI. However, in the code below the blue and green triangle should render on top of each other, but the green triangle is rendered incorrectly. Being a newbie, I hesitate to file a bug report... Can anyone

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-23 Thread Bas van Dijk
On 8/20/07, Stefan O'Rear [EMAIL PROTECTED] wrote: ... (I need to find some way to automate making these trails :) ) ... I think you can come a long way with the debugger in GHC HEAD. It provides a :trace command that, when applied to an expression with some breakpoint in it, remembers the

Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Adam Langley
On 8/23/07, Neil Mitchell [EMAIL PROTECTED] wrote: It's not even referentially transparent in all cases. a == b may fail while the double's are in the high precision registers, and then succeed later on in the program once they are truncated. I think you have to specify -fexcess-precision with

[Haskell-cafe] newbie - how to call a Haskell interpreter from C

2007-08-23 Thread Brock Peabody
Hi, I've been trying to find place to use Haskell at work, and I think a good opportunity will be to use it for our scripting language. To do that, I need to be able to invoke an interpreter directly from another language. I've investigated using HaskellScript (too web/ActiveX centric), but