all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* lisp performace question: how efficent are (long) list parameters?
@ 2004-01-10 16:35 leo
  2004-01-10 16:50 ` Joe Casadonte
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: leo @ 2004-01-10 16:35 UTC (permalink / raw)


hi there

just a little thing for a lisp beginner. i have written a function:

(defun first-free-position (positions)
  "returns the first free position in POSITIONS of all frames"
  (if positions
      (let ((list-of-frames (frame-list)))
        (if (frame-on-position (car positions) list-of-frames)
            (first-free-position (cdr positions))
          (car positions)))))

this function recomputes `(frame-list)' for every recursion. so i
thought to set `(frame-list)' to a variable which could be carried
through as parameter:

(defun first-free-position (positions all-frames)
  "returns the first free position in POSITIONS of all-frames."
  (if positions      
        (if (frame-on-position (car positions) all-frames)
            (first-free-position (cdr positions) all-frames)
          (car positions))))

called like `(first-free-position position-alist (frame-list))' this
version computes (frame-list) only once, but the list `all-frames' is
put every time on the parameter stack.

so, what is more effiecent?

cheers, leo

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

end of thread, other threads:[~2004-01-28  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-10 16:35 lisp performace question: how efficent are (long) list parameters? leo
2004-01-10 16:50 ` Joe Casadonte
2004-01-10 16:53 ` David Kastrup
2004-01-28  8:05 ` Kai Grossjohann

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.