Common Lisp has a pretty simple fix for this: when you declare a parameter with a default value, you can also declare a variable that will be true iff the parameter was actually passed.
The function definition looks like this:
(defun foo (&optional (a 1 a-passed))
(if a-passed (print a)
(print "a not passed"))
> (foo 10)
10
> (foo 1)
1
> (foo)
a not passed
This is still relatively easy to implement, and very easy to use in my opinion. Of course, combining this with named arguments is even better, and that is supported as well (just replace &optional with &key, and then specify the name when calling the function - (foo :a 1)).
The function definition looks like this:
This is still relatively easy to implement, and very easy to use in my opinion. Of course, combining this with named arguments is even better, and that is supported as well (just replace &optional with &key, and then specify the name when calling the function - (foo :a 1)).