Skip to content

Instantly share code, notes, and snippets.

@nyuichi
Created September 24, 2012 04:42
Show Gist options
  • Save nyuichi/3774210 to your computer and use it in GitHub Desktop.
Save nyuichi/3774210 to your computer and use it in GitHub Desktop.
deep binding vs shallow binding
;;;; **deep binding**
;;; look up
(cdr (assq 'the-symbol *the-stack*))
;;; funcall
; wind...
(loop for arg in args
for parm in parms
do (push (cons parm arg) *the-stack*))
; call...
(eval the-body)
; unwind...
(loop for parm in parms
do (pop *the-stack*))
;;; **shallow binding**
;;; look up
(car (symbol-value 'the-symbol))
;;; funcall
; wind...
(loop for arg in args
for parm in parms
do (push arg (symbol-value parm))
; call...
(eval the-body)
; unwind...
(loop for parm in parms
do (pop (symbol-value parm)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment