1、通常我们在使用emacs学习elisp时,先打开一个测试用的文件如lisp.el,这时emacs会自动切换成Emacs-lisp模式如下:
在这个lisp.el中输入我们想要学习的各种语法即可。
2、列表与函数的区别
在官方手册里有如下内容:
The single apostrophe, ', that I put in front of some of the example lists in preceding sections is called a quote:
when it precedes a list, it tells lisp to do nothing with the list, other than take it as it is written. But if there is no quote
preceding a list, the first item of the list is special: it is a command for the computer to obey. (In lisp, these commands
are called functions.)
即左括号前加单引号,表示后面是列表;
左括号前不加单引号,表示后面是函数。括号内第一个元素被当做函数名。
3、lisp语句的执行
参考官方手册有
place your cursor immediately after the right hand parenthesis of the following list and then type
(+ 2 2)
2、列表与函数的区别
在官方手册里有如下内容:
The single apostrophe, ', that I put in front of some of the example lists in preceding sections is called a quote:
when it precedes a list, it tells lisp to do nothing with the list, other than take it as it is written. But if there is no quote
preceding a list, the first item of the list is special: it is a command for the computer to obey. (In lisp, these commands
are called functions.)
即左括号前加单引号,表示后面是列表;
左括号前不加单引号,表示后面是函数。括号内第一个元素被当做函数名。
3、lisp语句的执行
参考官方手册有
place your cursor immediately after the right hand parenthesis of the following list and then type
(+ 2 2)
C-x C-e
即将光标放到右括号后,输入C-x C-e 即可执行。这里我们举两例子
1)列表的执行
1)列表的执行
'(+ 2 3)
执行结果如下:
2)函数的执行
(+ 2 3)
执行结果如下: