all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* defining a setter function with gv.el
@ 2012-08-27  5:56 Ivan Kanis
  2012-08-27 12:54 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Kanis @ 2012-08-27  5:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs help

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-31  0:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27  5:56 defining a setter function with gv.el Ivan Kanis
2012-08-27 12:54 ` Stefan Monnier
2012-08-27 18:10   ` Ivan Kanis
2012-08-27 20:28     ` Stefan Monnier
2012-08-30 16:05       ` Ivan Kanis
2012-08-31  0:59         ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.