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
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
--- 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
--- 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
--- 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
--- 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
--- 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:
--- 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 =
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
--- 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
--- 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:
--- 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
--- 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
--- 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
--- 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.
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
--- 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
17 matches
Mail list logo