Recurse Day 1
Originally at https://notes.shaunagm.net/post/643230161417994240/recurse-day-1
Day 1 of my Recurse mini batch is complete! I spent a good portion of it meeting people and learning about the community, but I did also make some small steps on my project:
-
I read through two tutorials, one on lisp generally and one on macros
-
I successfully got the simplest possible version of my project working:
;; 1. Simplest possible version
(defun cat-story (cat-name cat-location)
(format t "There once was a cat named ~a who lived in ~b" cat-name cat-location))
;; 2. Prompt in REPL for cat-name and cat-location?
(defvar cat-name) ; avoid warnings
(defvar cat-location) ; avoid warnings
(progn
(format t "What is the cat's name? ")
(force-output)
(setq cat-name (read-line))
(format t "Where does the cat live? ")
(force-output)
(setq cat-location (read-line))
(cat-story cat-name cat-location))
This version hard codes a story template and story variables, and the prompts are completely separate from the variables. But it does fulfil the very basic essence of a Madlibs program. :)
- Wrote a next attempt which doesn’t work yet:
(setq story-elements (list
(list "There once was a cat named ~cat-name who lived in ~cat-location")
(list "cat-name" "What is the cat's name?")
(list "cat-location" "What is the cat's location?")))
;; for now assume there are exactly three atoms in story, the first of which is the template
(defun tell-story (story)
(format t (second story))
(force-output)
(setq var1 (read-line))
(format t (third story))
(force-output)
(setq var2 (read-line))
(format t (first story) var1 var2))
(tell-story story-elements)
- I got some advice to check out Racket, Slime for Emacs, and the Common Lisp plugin for Slime for Emacs. Generally speaking, I am wrestling with the “how much time should I spend setting up my development environment?” question. With such a short batch, I don’t want to get two in the weeds. OTOH I am finding my current setup pretty annoying.
Overall, a good first day!