3 ms·
Personally I find Common Lisp in some cases slightly uglier, but clearer. (define foo (make-foo)) What is it? A function or a non-function? I prefer the Co
by lispm 3y ago
Personally I find Common Lisp in some cases slightly uglier, but clearer.
(define foo (make-foo))
What is it? A function or a non-function?
I prefer the Common Lisp version:
(defvar *foo* (make-foo)
"*foo* is the current input/output foo object.")
It's clear that DEFVAR usually defines a variable and not a function. Bonus: we can document the thing in a standard way.
For functions I would define a define macro.
(define foo (make-foo)
"foo is a function with two arguments of type bar, it returns ..."
(ftype (function (bar bar) baz))
Which would expand into a (setf fdefinition), a type declaration and setting the documentation.
I prefer the uglier, but better standardized and slightly more practical language.