Skip to content

Comment on Ask HN: Is Lisp Simple?

Comments

(defun <name> (list of arguments) > "docstring" > (function body))
How do I read this as an s-expression?

It's still a list.

You can re-write it as:

    (let ((my-list '(defun <name> (list of arguments) "docstring" (function body))))
     (print (first my-list))
     (print (second my-list))
     (print (third my-list))
     (print (fourth my-list)))
It will print:
    DEFUN
    <NAME>
    (LIST OF ARGUMENTS)
    "docstring"
If "docstring" appears twice when you run the above, that's because it's the value produced by the final form in the block, so it shows up as the return value of the block.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.