Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated keyword arguments #15

Open
svetlyak40wt opened this issue Aug 26, 2019 · 0 comments
Open

Duplicated keyword arguments #15

svetlyak40wt opened this issue Aug 26, 2019 · 0 comments

Comments

@svetlyak40wt
Copy link
Collaborator

If a function call has two pairs of keyword arguments with the same keyword, the leftmost argument pair is used. This can be helpful if a list of keyword arguments is received and you want to selectively override some value in that argument list in application. There’s no need to use mutation or produce a fresh variation of the list.

For example:

(defun write-escaped (object &rest args &key &allow-other-keys)
  (apply 'write object :escape t args))

* (write "hello" :escape nil)
hello

* (write-escaped "hello" :escape nil)
"hello"

See section 3.4.1.4 for details.

(source: https://lisptips.com/post/37350128056/duplicated-keyword-arguments)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant