Re: Lift and bind (was: Understanding the continuation monad's bind operator)

2010-01-12 Thread Graham Fawcett
Hi, On Mon, Jan 11, 2010 at 8:44 PM, Steven E. Harris s...@panix.com wrote: Konrad Hinsen konrad.hin...@fastmail.net writes: For a function of a single argument, m-lift and m-fmap are equivalent. In Jim Duey's essay Higher Level MonadsĀ¹, he writes the following on the lift operator:

Lift and bind (was: Understanding the continuation monad's bind operator)

2010-01-11 Thread Steven E. Harris
Konrad Hinsen konrad.hin...@fastmail.net writes: For a function of a single argument, m-lift and m-fmap are equivalent. In Jim Duey's essay Higher Level MonadsĀ¹, he writes the following on the lift operator: ,[ m-lift ] | If you have a function that you would like to turn into a monadic |

Re: Lift and bind (was: Understanding the continuation monad's bind operator)

2010-01-11 Thread jim
You know, I think you're right. I would refer you to part 2 of Konrad's monad tutorial, but the link is broken. Check google's cache, if you want to read an explanation immediately. I'll have to go change that. Thanks for pointing it out and sorry for any confusion. Jim Steven E. Harris wrote:

Re: Understanding the continuation monad's bind operator

2010-01-08 Thread Konrad Hinsen
On 8 Jan 2010, at 02:43, Steven E. Harris wrote: Can you recommend a book that covers aspects of monads like these? I'd like to learn more about the abstract concepts than their implementation in a particular language. I don't know about any books. There's a lot of monad material on the

Re: Understanding the continuation monad's bind operator

2010-01-07 Thread Konrad Hinsen
On 07.01.2010, at 01:56, Steven E. Harris wrote: I'm interested in what you mean by composite computation, because I think it's hinting at some concept for monads that I missed. If, as you say, executing the function immediately is not acceptable behavior, then I infer that the goal is to

Re: Understanding the continuation monad's bind operator

2010-01-07 Thread Konrad Hinsen
On 07.01.2010, at 02:23, Steven E. Harris wrote: That means that a monadic function has a signature like a - m b RIght. Say that we're looking to use some normal functions with this monad. Those functions may have signatures like a - b They clearly don't return the right kind of value.

Re: Understanding the continuation monad's bind operator

2010-01-07 Thread Steven E. Harris
Thank you, Konrad. Your explanation was perfect. -- Steven E. Harris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with

Re: Understanding the continuation monad's bind operator

2010-01-07 Thread Steven E. Harris
Konrad Hinsen konrad.hin...@fastmail.net writes: When the monadic values are functions representing computations, monadic composition yields a new function but doesn't execute anything. When the monadic values represent results of computations, then monadic composition implies execution of

Re: Understanding the continuation monad's bind operator

2010-01-06 Thread Steven E. Harris
Konrad Hinsen konrad.hin...@fastmail.net writes: Exactly. The result of m-bind must be a continuation-accepting function again. Yes, and invoking 'mv' yields such a function. That's the role of the outer layer (fn [c] ...). That one adds /another/ layer, but the inner function returned by

Re: Understanding the continuation monad's bind operator

2010-01-06 Thread Steven E. Harris
jim jim.d...@gmail.com writes: Don't know if you saw, but I did a whole tutorial on the continuation monad. Your essay is how I got started with monads in Clojure. I've read it six times now (along with five other of your essays on the subject), but perhaps I missed the requirement pertaining

Re: Understanding the continuation monad's bind operator

2010-01-06 Thread Steven E. Harris
I have a few more questions concerning how one interacts with a continuation monad. It's clear that a monadic function accepts some base value and returns a monadic value, in turn being a function accepting a single continuation argument. That means that a monadic function has a signature like

Re: Understanding the continuation monad's bind operator

2010-01-05 Thread Konrad Hinsen
On 05.01.2010, at 02:23, Steven E. Harris wrote: , | (fn m-bind-cont [mv f] | (fn [c] | (mv (fn [v] ((f v) c) ` I'm curious why there's an extra delaying wrapper function there. The outermost `fn' form taking the argument c as a continuation looks like it serves only

Understanding the continuation monad's bind operator

2010-01-04 Thread Steven E. Harris
In clojure.contrib.monads, there's a monad defined called cont-m to model continuations. Its bind operator -- `m-bind` -- is defined as follows: , | (fn m-bind-cont [mv f] | (fn [c] | (mv (fn [v] ((f v) c) ` I'm curious why there's an extra delaying wrapper function there. The

Re: Understanding the continuation monad's bind operator

2010-01-04 Thread jim
Don't have time to go in depth on an explanation. But remember that m- bind must work with m-result according to the 3 monadic laws. This constrains what it can do. Don't know if you saw, but I did a whole tutorial on the continuation monad. It's at: