Skip to content

Instantly share code, notes, and snippets.

@dumbs
Created November 5, 2010 18:53
Show Gist options
  • Save dumbs/664599 to your computer and use it in GitHub Desktop.
Save dumbs/664599 to your computer and use it in GitHub Desktop.
(defun make-stat-env (params &optional env)
(append
(loop
for var in params
for j = 1 then (+ j 1)
for num-env = (if (or (eq (first env) '&optional)
(eq (first env) '&rest)) nil (+ (or (second (first env)) -1) 1))
collect (list var num-env j)
)
env))
(make-stat-env '(a b &optional c)) => ((A 0 1) (B 0 2) (&OPTIONAL 0 3) (C 0 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment