ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

consider adding `do-nothing` #159

Closed bo-tato closed 9 months ago

bo-tato commented 10 months ago

Sometimes when I have a function that takes as an argument a hook or callback it will call, one common behavior often the default is to do nothing. It can have the argument default to nil, and check always if it's a function, then call it otherwise if it's nil do nothing. But by having the argument default to do-nothing function instead of nil, the code is simpler, it's always a function we can call and we don't have to add extra checks. I added in my utilities as:

(defun do-nothing (&rest ignore)
  (declare (ignore ignore)))

I saw it is included in LispWorks http://www.lispworks.com/documentation/lw50/LWRM/html/lwref-291.htm Maybe it's worth adding to serapeum