Skip to content

Instantly share code, notes, and snippets.

@letoh
Created April 25, 2013 13:23
Show Gist options
  • Select an option

  • Save letoh/5459643 to your computer and use it in GitHub Desktop.

Select an option

Save letoh/5459643 to your computer and use it in GitHub Desktop.
lexical binding in elisp
(require 'cl)
(defun make-greeter (greeting-prefix)
(lexical-let ((greeting-prefix greeting-prefix))
(lambda (username) (concat greeting-prefix ", " username))))
(let ((f (make-greeter "hello")))
(funcall f "world"))
(funcall (make-greeter "hello") "world")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment