Converting other newLISP code to Rockets

Blog post

Author
Message

Rocket Man
Posts: 383
Posted on: 2013-02-21 18:54:17.000
Today I relaunched my personal website at http://www.jeremyreimer.com. It had previously been running on Dragonfly, a web development framework that inspired me to write Rockets.

Converting the code was really easy. All it took was the following:

1. Replace all instances of (print) with (display) and (println) with (displayln)
2. Remove Dragonfly-specific functions like (web-root) that are no longer necessary.
3. Make sure to start each page with:


#!/usr/bin/env newlisp

(load "newlisp-rockets.lisp") ; this is where the magic happens!


and end each page with


(display-footer "Jeremy Reimer")
(display-page)


And that's pretty much it! So if you want to convert any Dragonfly code to Rockets, that's how you do it.

Rocket Man
Posts: 383
Posted on: 2013-02-21 19:07:41.000
Oh, there are some other changes:

Remove all <% and %> tags

(Response:redirect) becomes (page-redirect)
(Response:cookie) becomes either (set-cookie) or (delete-cookie)

But these are pretty minor changes.

xerxes
Posts: 107
Posted on: 2013-02-22 14:10:48.000
I never actually got my Dragonfly site going: too much else on the go.

But it interests me now to think how mystified I was by Dragonfly. I realise now that it was the html/css etc web writing side more than the newLISP that bewildered me, and although I admired the use of a cgi "listener", I could never quite grok how it worked. Looking at the above reinforces the conclusion... actual newLISP changes are minimal.


Views: 9521