screwlisp proposes kittens

emacs clkitten parenscript eev kitten of tutorial 2

Intro

Well, it seems to have worked super, super easily.

My main goal is to use eepitch to conjure a kitten in this instance as I planned before. I am not totally sure how parenscript is going to play out. I don’t really want all-of-modern-javascript, just enough to interface lisp and kitten.

In the code block, in emacs with eev, assuming you have sbcl, parenscript and spinneret as well as Aral’s Kitten available on your computer, just pressing F8 over and over again populates a kitten directory and starts serving the dynamically updating tutorial page on https://localhost, and visits it with emacs eww.

Probably use quicklisp.org to install Spinneret and Parenscript in sbcl if you are not sure what to do.

eepitch, lisp, and serve a kitten

#|
 (eepitch-sbcl)
 (eepitch-kill)
 (eepitch-sbcl)
|#
(require "asdf")

(ensure-directories-exist #p"~/kittens/tutorial-2/")

(asdf:load-system :spinneret)
(uiop:define-package :clkitten
    (:mix :spinneret :parenscript :cl))

(in-package :clkitten)

(asdf:load-system :spinneret/ps)

;;; Two modifications to parenscript useage:

(defun chop (string)
  (replace string " " :start1 (1- (length string))))

(defun var→let (var)
  (replace var "let"))
  

#p"~/kittens/tutorial-2/"
(merge-pathnames #p"index.page.js" *)
(with-open-file
    (*standard-output* * :direction :output
			 :if-exists :supersede
			 :if-does-not-exist :create)
  (format t "~@{~?~^~%~}"
	  
	  "~a~%"
	  (list
	   (var→let
	    (ps (var count 1))))
	  
	  "export default () => kitten.html`~@{~a~%~}`"
	  (list
	   (with-html-string
	     (:h1 "Kitten count")
	     (:p (:raw "${"
		       (chop
			(ps (chain
			     "đŸ±"
			     (repeat (incf count)))))
			"}"))))))
#|
 (eepitch-kill
 (eepitch-shell)
cd ~/kittens/tutorial-2/
kitten

 (eww "https://localhost")
|#

That was really convenient!

Did it work trivially for you? Let me know (or otherwise) on the Mastodon thread.

I think mdhughes was in one sense right tht the ease of clkittens like my kitten tutorial here multiplying is reminiscent of Hurkles. The Hurkle is a happy beast.

My feeling here is sort of to have demon-like-software become is-each-independently-a-kitten and have them herd over tls. The two update changes to parenscript’s javascript to make it kitten compatible don’t seem like big deals - honestly, I can’t tell why the semicolon needs to be chopped, maybe because literal-string-templates are not meant to use side effects implied by semicolons. It seems odd to me that you basically have to define javascript let yourself manually, but maybe that’s the parenscript intent. I guess one can find out about javascript repeat through the tutorial: In practice I expect the string will be made with lisp instead.

screwlisp proposes kittens