Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Theoretical application for request continuations.
- (defmacro branch (text &body branches)
- (let ((contsym (gensym "CONTINUATION"))
- (rqvarsym (gensym "REQUEST")))
- `(let ((,contsym (with-request-continuation (:new-request-var ,rqvarsym)
- (string-case ((get-var "choice" ,rqvarsym))
- ,@branches))))
- "<generated form with choices and text, too lazy to code it out here.>")))
- (defpage #p"adventure./" ()
- (branch "You are standing on a green field."
- ("Go left"
- (branch "You enter a dark forest."
- ("Go further" "A wolf eats your face.")
- ("Wait" "A wolf eats your face.")))
- ("Go right"
- (branch "You enter a bright city."
- ("Enter a bar" "You are killed by a hooker.")
- ("Enter a casino" "You are killed by a hooker.")
- ("Leave" "You are killed by a hooker.")))
- ("Wait" "Birds peck your brains out.")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement