Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Too many brackets and dashes. Arithmetic expressions look unfamiliar, and class declarations too. I am a PHP developer by the way.

Also, I noticed a use of eval:

             (when (and unclicked-thing (eql unclicked-thing clicked-thing))
                 (let ((*package* (find-package :cl-user)))
                   (eval (read-from-string (third unclicked-thing)))))))))))
Also, some function names do not start with a verb, like "(defun desktop-main (desktop)".



> some function names do not start with a verb

defun is actually a complete sentence, contracted, as others have pointed out. Defining a function uses a noun-like keyword in some languages. For instance in, oh, Awk, the function keyword is used.

There is a def prefix convention in Lisp, as well as a define- one: defmacro, defclass, defconstant, ... define-symbol-macro, define-setf-expansion. The def-s are contracted words with no dashes; the define-s are whole words joined by dashes. All the macros named this way have a some global defining effect, and are mainly used used as top-level forms: if you see one nested in code, then that's a red flag.

Functions are often named verbs when they are not actually functions, but procedures: subroutines that have a side effect: print, put_pixel, sort, connect, ...

Functions that calculate something from their arguments and return a value are often not named after verbs, but rather nouns.

Even if you aren't familiar with functional programming, you probably know some pure functions in some languages. For instance, arithmetic ones: sin, sqrt, atan. Or how about accessors that retrieve the property or state of an object: length, position, temperature. All these are nouns.

(Sometimes pure functions are verbed, after the process that they perform to calculate the return value, such as join, catenate. sort and reverse could be names pure functions that returns a sorted sequence, though reverse is also a noun (function that returns the reverse of its input)).

Blind adherence to rules like "functions must start with verbs" is a symptom of cargo cult programming.


It seems you should learn more about Lisp—and how to read it—before criticizing it as unreadable. As it is, your comment simply reads as if you were saying, "French is unreadable because I only know English." Of course it is. So learn how to read the new language.


FWIW, noun-verb ordering of functions is reasonably idiomatic in lisp, particularly when single-dispatch might be used in other languages.

The usage of eval there makes sense because it is launching a program. It's equivalent to e.g. using system() or /bin/sh in a launcher on a unix system.


The eval here seems to be providing the feature of exposing Lisp evaluation to the end user via some UI field. It's not "I used eval because I don't know about apply or macros".

How did this unreadable gobbledyook fail to conceal its use of eval from your eyes?


DEFUN is not a function.

It's a definition macro and stands for `DEFINE FUNCTION`.

These defining macros are beginning by a style convention with DEF: DEFUN, DEFMACRO, DEFCLASS, DEFVAR, ...


I think GP was complaining about desktop-main, not about defun.


thanks, seeing that now...

But that's not unusual in Lisp, as functions may be seen as objects, getters, formulas, etc..

For example a function maybe a top level loop. Then I might call it TOP-LEVEL-LOOP and not run-top-level-loop or similar.


FYI, DEFUN is a verb in Lisp - DEfine FUNction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: