Timeline for How to pass function as argument in elisp
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 18, 2015 at 13:15 | answer | added | rocky | timeline score: 9 | |
Aug 14, 2015 at 14:17 | comment | added | Luis404 | yeah, thanks for your suggestion. I will try | |
Aug 14, 2015 at 13:39 | comment | added | Harald Hanche-Olsen | The two namespaces vs one issue is one of the big differences between elisp and common lisp on one hand, and scheme on the other. You are bound to be confused if you read SICP and practice in a lisp-2 (as the kind with separate name spaces for variables and functions are called). Perhaps you should get an actual scheme implementation to play with? | |
Aug 14, 2015 at 12:27 | comment | added | Dan♦ | @wvxvw: could you write up your comment as an answer, please? | |
Aug 14, 2015 at 11:00 | comment | added | Luis404 | do you mean this: sum 'inc-test 1 'inc-test 10 ??? got this error: usage: sum : (TERM A NEXT B) | |
Aug 14, 2015 at 10:58 | comment | added | wvxvw |
Emacs Lisp has two namesapces for functions and for variables. This means that inc-test in your last example is used as a variable, but is not defined as a variable (it is a function). You need to pass either a symbol or a function reference to funcall . Hence one way of fixing your code is to pass it 'inc-test instead of inc-test (note the quote).
|
|
Aug 14, 2015 at 10:52 | comment | added | Luis404 | Hi, add the calling example | |
Aug 14, 2015 at 10:51 | history | edited | Luis404 | CC BY-SA 3.0 |
added 128 characters in body
|
Aug 14, 2015 at 10:49 | comment | added | Dan♦ |
How are you calling sum ?
|
|
Aug 14, 2015 at 10:47 | history | asked | Luis404 | CC BY-SA 3.0 |