Tom Prince <tom.pri...@ualberta.net> writes: > Perhaps > > ,----------------------------------------------------------- > | (defun main-function (args) > | (let ((var (assoc :key1 args))) ; extracting var once > | ... > | (helper-function1 ... var ...) ; inside let using var > | (helper-function2 ... var ...) ; inside let using var > | )) > | > | (defun helper-function1 (var') > | ... > | ) > | > | (defun helper-function2 (var') > | ... > | ) > `----------------------------------------------------------- > > or > > ,------------------------------------------------------------- > | (defun get-key1 (args) (assoc :key1 args)) > | (defun main-function (args) > | (let ((value (get-key1 args)) ; extracting var 1st time > | ... > | ) > | (helper-function1 ...) ; outside let > | (helper-function2 ...) ; outside let > | ) > | > | (defun helper-function1 (args) > | (let ((value (get-key1 args)) ; extracting var 2nd time > | ... > | )) > | > | (defun helper-function2 (args) > | (let ((value (get-key1 args)) ; extracting var 3rd time > | ... > | )) > `------------------------------------------------------------- > > > I likely wouldn't suggest the second, unless get-key1 was actually > something more complicated than your example.
hmm ... I feel quite convinced now that having a standalone function is worth a bit of code duplication, and I start do discover that the cl package does have some nice functions (like flet). cheers -- Thorsten