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:
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: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