Monday, March 30, 2009

best practices: adding 1 in lisp

Instead of (+ 1 x), we should better use (1+ x) if we just want to use the value. And if we want to update x also then we should use (incf x). I don't know whats the exact logic, but probably its the conciseness.
It also seems aligned with what is said in PAIP, "Using the most specific form possible makes it easier for your reader to understand your intent."

No comments:

Post a Comment