sds answer describes an identification function that matches the specification you requested: it's pretty simple (lambda (x) x) . However, it is worth noting that in a function such as
(defun some-function (value &optional (transformation (lambda (x) x))) (other-function (funcall transformation value))
it may be more idiomatic to describe your transformation as a key and let nil indicate that the key function should not be applied to the value. This behavior is present in many common Lisp functions. For example, member accepts a key argument that is applied to each element of the sequence to create a value that is compared to the search element:
CL-USER> (member nil '(1 2 3 4 nil 5 6 7 8)) (NIL 5 6 7 8) CL-USER> (member nil '(1 2 3 4 nil 5 6 7 8) :key 'oddp) (2 3 4 NIL 5 6 7 8)
The default behavior is the same as if you passed the identifier as a key:
CL-USER> (member nil '(1 2 3 4 nil 5 6 7 8)) (NIL 5 6 7 8) CL-USER> (member nil '(1 2 3 4 nil 5 6 7 8) :key 'identity) (NIL 5 6 7 8)
However, the default value is not identity , but nil . HyperSpec for member says the key:
key is the designation for a function of one argument or nil .
This is stated in 17.2.1 Satisfying a two-argument test , which states that:
If the key argument is provided ::, it is the function designation, one argument that should be called with each Ei as an argument, and a Zi object that will be used for comparison. (If not: key argument, Zi Ei.)
If you want to accept this type of convention, then your code will be something like
(defun some-function (value &optional transformation) (other-function (if (null transformation) value (funcall transformation value))))
In your case, this may not be a big difference, but it will avoid calling an additional function. In general, this can be useful because it makes it easier to pass key arguments to library functions without worrying about whether they are nil or not.