[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lisp performace question: how efficent are (long) list parameters?
From: |
leo |
Subject: |
lisp performace question: how efficent are (long) list parameters? |
Date: |
11 Jan 2004 03:35:04 +1100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
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
- lisp performace question: how efficent are (long) list parameters?,
leo <=