all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* some more material on the Lisp data/code psychedelia
@ 2014-01-04 19:37 Emanuel Berg
  2014-01-04 20:13 ` Thien-Thi Nguyen
       [not found] ` <mailman.11016.1388866201.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Emanuel Berg @ 2014-01-04 19:37 UTC (permalink / raw)
  To: help-gnu-emacs

The whole discussion on types and the Lisp data/code
blend was the source of some confusion. But perhaps
that's nothing to be ashamed of.

I thought it would be clearer if I could turn it into
actual code. So if you don't mind, please comment on
this.

(defun increment-last (l)
  (interactive)
  (if (not l) '()
    (let ((hd (car l))
          (tl (cdr l)) )
      (if (not tl)
          (list (+ 1 hd))
        (cons hd (increment-last tl) )))))

;; test
(increment-last '())       ; => '()
(increment-last '(1))      ; => '(2)
(increment-last '(1 2 3))  ; => '(1 2 4)

(defun do-change-me ()
  (interactive)
  (fset 'do-change-me
        (increment-last (symbol-function 'do-change-me)) )
  1)

(do-change-me) ; hit `C-x e' repeatedly here

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

end of thread, other threads:[~2014-01-17  1:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-04 19:37 some more material on the Lisp data/code psychedelia Emanuel Berg
2014-01-04 20:13 ` Thien-Thi Nguyen
     [not found] ` <mailman.11016.1388866201.10748.help-gnu-emacs@gnu.org>
2014-01-04 20:24   ` Emanuel Berg
2014-01-04 23:40     ` Emanuel Berg
2014-01-17  1:29       ` Emanuel Berg

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.