[Haskell-cafe] FAQ: Why no interactive definitions?

2005-12-22 Thread Greg Woodhouse
In neither GHCi nor Hugs (so far as I know) is it possible to interactively enter definitions. coming from Scheme, this was a bit of a surprise, as I'm used to being able to enter, say (define mysquare (lambda (x) (* x x))) Is this just a matter of the feature not being implemented, or

[Haskell-cafe] Fwd: Monads and pedagogy (Functions with side-effects?)

2005-12-21 Thread Greg Woodhouse
Oops...meant to send this to the list, too. --- Greg Woodhouse [EMAIL PROTECTED] wrote: Date: Wed, 21 Dec 2005 09:42:44 -0800 (PST) From: Greg Woodhouse [EMAIL PROTECTED] Subject: Monads and pedagogy (Functions with side-effects?) To: David Barton [EMAIL PROTECTED] --- David Barton

Re: [Haskell-cafe] Functions with side-effects?

2005-12-21 Thread Greg Woodhouse
--- Wolfgang Jeltsch [EMAIL PROTECTED] wrote: I think Phil Wadler said it best when he said that a monad is a *computation*. To be honest, I'm still struggling with the monad concept myself. Oh sure, I can read the definition and it makes sense. But I'm still missing that aha! moment when

Re: Re[2]: [Haskell-cafe] Monads in Scala, XSLT, Unix shell pipes was Re: Monads in ...

2005-11-27 Thread Greg Woodhouse
--- Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Greg, for pure functional computations concurrency is just one of IMPLEMENTATION mechanisms, and it doesn't appear in abstractions DEFINITIONS I suppose it depends a bit on the question you're asking. A multiprocessor, considered as a

Re: [Haskell-cafe] Monads in Scala, XSLT, Unix shell pipes was Re: Monads in ...

2005-11-26 Thread Greg Woodhouse
--- Shae Matijs Erisson [EMAIL PROTECTED] wrote: Geoffrey Alan Washburn [EMAIL PROTECTED] writes: There's also Oleg's http://okmij.org/ftp/Computation/monadic-shell.html at the level of UNIX programming, all i/o can be regarded monadic. Interesting. I had been thinking about I/O and

RE: [Haskell-cafe] using of data types as kinds

2005-11-22 Thread Greg Woodhouse
--- Simon Peyton-Jones [EMAIL PROTECTED] wrote: Read about Omega! I will. Busy doing GADTs and impredicativity at the moment though Impredicativity? === Gregory Woodhouse [EMAIL PROTECTED] Interaction is the mind-body problem of computing. --Philip Wadler

Re: [Haskell-cafe] Records

2005-11-22 Thread Greg Woodhouse
--- Sven Panne [EMAIL PROTECTED] wrote: I think this discussion has reached a point where it is of utmost importance to re-read Wadler's Law of Language Design, a law so fundamental to computer science that it can only be compared to quantum dynamics in physics:

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-18 Thread Greg Woodhouse
--- Paul Hudak [EMAIL PROTECTED] wrote: This is a very late response to an old thread... Tom Hawkins wrote: In a pure language, is it possible to detect cycles in recursive data structures? For example, is it possible to determine that cyclic has a loop? ... data Expr =

[Haskell-cafe] Formalizing lazy lists?

2005-11-18 Thread Greg Woodhouse
Maybe this is old hat, but the question about detecting loops in data structures got me thinking about this. I know you can encode the cons operator (and ordinary lists) in pure lambda calculus, but how could you possibly represent something like [0, 1..]? One thought that occurss to me is to

Re: [Haskell-cafe] Formalizing lazy lists?

2005-11-18 Thread Greg Woodhouse
--- Lennart Augustsson [EMAIL PROTECTED] wrote: What do you mean by represent? It's easy enough to write down the lambda term that is the encoding of [0..]. -- Lennart You mean like \x - x ? If I apply it to the Church numeral i, I get i in return. But that hardly seems

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-18 Thread Greg Woodhouse
--- Paul Hudak [EMAIL PROTECTED] wrote: I suspect from your other post that you haven't seen the standard trick of encoding infinite data structures as fixpoints. Suppose you have a lambda calculus term for cons, as well as for the numeral 1. Then the infinite list of ones is just:

Re: [Haskell-cafe] Formalizing lazy lists?

2005-11-18 Thread Greg Woodhouse
--- Lennart Augustsson [EMAIL PROTECTED] wrote: How about: nil = \ n c . n cons x xs = \ n c . c x xs zero = \ z s . z suc n = \ z s . s n listFromZero = Y ( \ from n . cons n (from (suc n))) zero (Untested, so I might have some mistake.) -- Lennart Okay, I see what

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-18 Thread Greg Woodhouse
--- Paul Hudak [EMAIL PROTECTED] wrote: The important property of Y is this: Y f = f (Y f) Right. This is just a formal statement of the property thaat f fixex Y f. I'm with you so far. In this way you can see it as unwinding the function, one step at a time. If we define f as

Re: [Haskell-cafe] Formalizing lazy lists?

2005-11-18 Thread Greg Woodhouse
--- Lennart Augustsson [EMAIL PROTECTED] wrote: Unfolding Y is indeed part of the algorithm to generate the list. The lambda calculus is just another programming language, so why does this disturb you? Well...think about this way. The function f i = [1, 1 ..]!!i is just a constant

Re: [Haskell-cafe] Infinite lists and lambda calculus

2005-11-18 Thread Greg Woodhouse
--- Lennart Augustsson [EMAIL PROTECTED] wrote: It computes the fix point which you can also define as oo fix f = lub f^i(_|_) i=0 where f^i is f iterated i times. Is that a definition of fixpoint that makes you happier? Believe it or not, yes.

Re: [Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

2005-11-17 Thread Greg Woodhouse
Isn't there a potential for confusion with function composition (f . g)? That being said, I like this idea (I just need to think it through a bit).Joel Reymont [EMAIL PROTECTED] wrote: I second this motion! I rather like Simon's proposal.On Nov 17, 2005, at 5:00 PM, Fraser Wilson wrote: Yeah, I

Re: [Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

2005-11-17 Thread Greg Woodhouse
--- Cale Gibbard [EMAIL PROTECTED] wrote: Actually, I didn't mention this in the other post, but why not the other way around? Make record selection (#) or (!) (though the latter gets in the way of array access), and leave (.) for function composition. Actually, the fact that (!) is the