title: How to call lambda passed a parameter in LISP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5357656/how-to-pass-a-lambda-expression-in-elisp">How to pass a lambda expression in Elisp</a>  </p>
  </blockquote>
  
  
  
  <p>I have following code:</p>
  
  <pre><code>(defun my-map (p l)
    (mapcar (lambda (el) (p el)) l))
  
  (defun test ()
    (my-map (lambda (x) (+ x 1)) (list 1 2 3)))
  </code></pre>
  
  <p>(It's example - not actual code I tried to write). It complains that it cannot find function p:</p>
  
  <pre><code>Debugger entered--Lisp error: (void-function p)
    (p el)
    (lambda (el) (p el))(1)
    mapcar((lambda (el) (p el)) (1 2 3))
    my-map((lambda (x) (x + 1)) (1 2 3))
    test()
    eval((test) nil)
    eval-expression((test) nil)
    call-interactively(eval-expression nil nil)
    recursive-edit()
    debug(error (void-variable test))
    eval(test nil)
    eval-expression(test nil)
    call-interactively(eval-expression nil nil
  </code></pre>
  
  <p>I guess that it treats a <code>p</code> as symbol and not variable bounded in outer scope. How to make it work?</p>