Sneak Peek

6 views
Skip to first unread message

jim

unread,
Nov 24, 2009, 11:21:53 PM11/24/09
to Clojure
Evening all,

I've been working on a library for writing web applications for
compojure. I've got it written and (I think) working. First thing
tomorrow is to write a sample app and post it along with the library.

But in the meantime, I thought I'd let you all read about it if you're
having trouble sleeping. :)

http://intensivesystems.net/tutorials/web_sessions.html

One thing I love about FP in general and Clojure specifically is the
density of code that is possible. This library is only about 80 lines
of code.

Jim

Graham Fawcett

unread,
Nov 25, 2009, 9:07:49 AM11/25/09
to clo...@googlegroups.com
Hi Jim,

On Tue, Nov 24, 2009 at 11:21 PM, jim <jim....@gmail.com> wrote:
> Evening all,
>
> I've been working on a library for writing web applications for
> compojure. I've got it written and (I think) working. First thing
> tomorrow is to write a sample app and post it along with the library.
>
> But in the meantime, I thought I'd let you all read about it if you're
> having trouble sleeping. :)
>
> http://intensivesystems.net/tutorials/web_sessions.html

Neat. It looks like you're writing what's usually called a
"continuation-based web framework". When I read your title and first
couple paragraphs, I thought you were writing a session-management
library (e.g. setting cookies, keeping server-side state, etc.). You
might consider mentioning continuations somewhere in your article, if
only to attract Googling continuation-based fans.

You might already be familiar with other continuation-based
frameworks. If not, consider looking at projects like Wee (for Ruby)
and Seaside (for Smalltalk) to steal some ideas. :)

Best,
Graham

>
> One thing I love about FP in general and Clojure specifically is the
> density of code that is possible. This library is only about 80 lines
> of code.
>
> Jim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

jim

unread,
Nov 25, 2009, 9:32:39 AM11/25/09
to Clojure
Graham,

That's exactly what it is. I used the continuation monad from
clojure.contrib.monads. After I get the code out, I'll be writing a
tutorial on how it works which will also explain the continuation
monad. I found that monad to be the most difficult to get my head
around, but it's hugely powerful. Using it, that library only took
about 50 lines of code to write. Having to account for browser history
took another 30. However, those 50 lines of code will turn your brain
to mush if you don't have a handle on the continuation monad. :)

Jim

Konrad Hinsen

unread,
Nov 25, 2009, 9:59:24 AM11/25/09
to clo...@googlegroups.com
On 25.11.2009, at 15:32, jim wrote:

> That's exactly what it is. I used the continuation monad from
> clojure.contrib.monads. After I get the code out, I'll be writing a
> tutorial on how it works which will also explain the continuation
> monad. I found that monad to be the most difficult to get my head
> around, but it's hugely powerful.

I can confirm that impression... And only wish you good luck writing
that tutorial!

Konrad.

Martin Coxall

unread,
Nov 27, 2009, 7:17:47 AM11/27/09
to Clojure


On Nov 25, 2:32 pm, jim <jim.d...@gmail.com> wrote:
> Graham,
>
> That's exactly what it is. I used the continuation monad from
> clojure.contrib.monads.

Mention it on the website, and you instantly win +50 bonus Web 2.0
points for buzzword-compliance. Congraturation!

> After I get the code out, I'll be writing a
> tutorial on how it works which will also explain the continuation
> monad. I found that monad to be the most difficult to get my head
> around, but it's hugely powerful.

I'd like to read that tutorial. Will you be as explicit about creative
use of continuations as Haskell is?

"Abuse of the Continuation monad can produce code that is impossible
to understand and maintain."

That sounds like a challenge. THAR BE DRAGONES.

Martin

Martin Coxall

unread,
Nov 27, 2009, 11:27:29 AM11/27/09
to Clojure
From the Haskell boys:

"Abuse of the Continuation monad can produce code that is impossible
to understand and maintain."

That sounds to me like a challenge.

jim

unread,
Nov 27, 2009, 1:16:53 PM11/27/09
to Clojure
I discovered a rather subtle bug as I was coding an example web-app,
so I haven't got the code out yet. Will ASAP.

That tutorial is going to take a little time to write, because as the
Haskell folks note, "Here be dragons!". The continuation monad is one
of the most powerful and can be considered the mother of all monads:

http://blog.sigfpe.com/2008/12/mother-of-all-monads.html

But it will turn your brain to mush if you're not careful.

Jim
Reply all
Reply to author
Forward
0 new messages