I recently wrote Lisp code. In particular, recursive functions that take some data and create the resulting data structure. Sometimes it seems that I need to pass two or three pieces of information to the next function call in addition to the data provided by the user. Lets call these batteries.
What is the best way to organize these interfaces for my code?
I am currently doing something like this:
(defun foo (user1 user2 &optional acc1 acc2 acc3)
;; do something
(foo user1 user2 (cons x acc1) (cons y acc2) (cons z acc3)))
This works the way I would like, but I am worried that I really don't need to provide & optional parameters for the programmer.
I consider several approaches:
There is a wrapper function that the user can use that immediately calls the extended qualifier.
use labelsinside a function whose signature is short.
just start using loop and variables. However, I would rather not do this, as I would really like to wrap my head around recursion.
Thanks guys!
source
share