[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: alist-get in Emacs 24?
From: |
Drew Adams |
Subject: |
RE: alist-get in Emacs 24? |
Date: |
Thu, 8 Oct 2015 08:53:55 -0700 (PDT) |
> Second, yes, you could modify the list structure, but this can't be
> done if the alist is empty, because the empty (a)list is not a cons.
> At least in this case, your setter would still have to receive a symbol.
I don't see it that way. How is this different from defining
`delete' or any of the other structure potentially-modifying
functions? None of those functions require you to pass a symbol
argument. The only function I can think of offhand that does
that is `add-to-list'. Its more common (and generally more useful)
cousins, `push' and `pushnew' don't do that.
Yes, with such (destructive) functions, if you have a variable
pointing to the list (empty or not), you do need to re-set it
to the result returned by the function. But that's all, AFAIK.
As I said (examples):
(setq THE-VAR (my-set-alist-value key alist value))
(setq foo (delete 42 foo))