Skip to content

Instantly share code, notes, and snippets.

@joekarma
Created October 27, 2012 20:05
Show Gist options
  • Select an option

  • Save joekarma/3965955 to your computer and use it in GitHub Desktop.

Select an option

Save joekarma/3965955 to your computer and use it in GitHub Desktop.
Common Lisp Website Using Only SEXP Syntaxes. Depends on '(:restas :cl-who :css-lite :parenscript)
(restas:define-module :hello-world-app
(:use :cl :cl-who))
(in-package :hello-world-app)
(restas:define-route index ("/")
(with-html-output-to-string (s nil :prologue t :indent t)
(:html
(:head
(:title "Hello World!")
(:style :type "text/css"
(str (css-lite:css
(("body")
(:background-color "green")))))
(:script :type "text/javascript"
(ps:ps-to-stream s
(defun flash-background ()
(let ((background-toggle nil))
(set-interval (lambda ()
(if background-toggle
(setf document.body.style.background-color "red")
(setf document.body.style.background-color "green"))
(setf background-toggle
(not background-toggle)))
500)))
(setf onload flash-background))))
(:body
(:h1 "Hello, World!")))))
(restas:start :hello-world-app
:port 8080
:hostname "localhost")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment