Today I didn't do much reading about CL, but I did at work last night. Specifically, I read Paul Graham's essays "Beating The Averages" (on how Lisp helped give him and Robert Morris a huge competitive advantage when they were working on Viaweb) and the beginning of "The Roots of Lisp.". I also read a little bit of On Lisp.
Today, I wrote a short tip calculator program to drive home some of the stuff I already know about Lisp. It's available in this repo under code/Nov2018/30
. One thing I found surprising is that Common Lisp doesn't have a built-in function for parsing decimal types from strings. It does, however, have one for parsing integers out of strings aptly named parse-integer
. I guess I'm gonna have to write my own macro for this to extend the syntax myself. But for now it just works with integer values.
Also, something I want to note: I don't like how it's standard CL style to have all of the closing parentheses be on one line. For example, take this function:
(defun get-tip (price percentage)
(* price (/ percentage 100)))
This isn't too bad with only three closing parentheses but imagine this was a much longer function. It could get really ugly really fast. I wish it was standard to style them like in C-influenced languages where there's one closing bracket per line on the same indent level as the opening of the code block it's closing. So in Lisp it would look like this:
(defun get-tip (price percentage)
(* price (/ percentage 100))
)