help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defining a setter function with gv.el


From: Ivan Kanis
Subject: defining a setter function with gv.el
Date: Mon, 27 Aug 2012 07:56:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Stefan,

I am very new to setf. I would like to write a function that provides a
place for setf to work on an alist. It would be wonderful if the
function also worked as a getter.

(setq foo '((oak . tree)))

(defun my-function (&optional value)
  (if value
      (?)
    (cdr (assoc 'oak tree))))

(my-function) => tree

(my-function 'shrub)

foo => '((oak . shrub))

gv.el seems to have what I need to implement the setf portion. It
doesn't provide example and I couldn't find doc in the elisp info.

Could you, pleas, help me?

Take care,
-- 
Ivan Kanis
http://ivan.kanis.fr

Success is counted sweetest
By those who ne'er succeed.
To comprehend a nectar
Requires sorest need.
    -- Emily Dickinson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]