在 2018年6月16日星期六 UTC+8下午5:25:54,Marko Rauhamaa写道:
Post by Marko RauhamaaPost by Michael KallweittPost by å鍿¡¥How can I learn emacs lisp in a comfortable way?By the way ,I know C\C++ and Java.
As you may have noticed, Lisp is very different from C, C++, and Jave.
Actually, lisp is not all that different at all.
f(a, b, 3);
(f a b 3)
a * (3 - b / 2)
(* a (- 3 (/ b 2)))
Lisp, like Java and Python, uses garbage collection. Lisp, like Python,
allows any variable to hold a value of any type.
Idiomatic lisp favors heavy use of recursion instead of "while" or
"for", but "while" is available in lisp, as well.
Marko
Thinks a lot!
compare as C language,when function become more complex,I found Lisp function become
a little more hard to read and understand, such as this example:
-----------------------------------------------------------
(defun append-to-buffer (buffer start end)
"Append to specified buffer the text of the region.
It is inserted into that buffer before its point.
When calling from a program, give three arguments:
BUFFER (or buffer name), START and END.
START and END specify the portion of the current buffer to be copied."
(interactive
(list (read-buffer "Append to buffer: " (other-buffer
(current-buffer) t))
(region-beginning) (region-end)))
(let ((oldbuf (current-buffer)))
(save-excursion
(let* ((append-to (get-buffer-create buffer))
(windows (get-buffer-window-list append-to t t))
point)
(set-buffer append-to)
(setq point (point))
(barf-if-buffer-read-only)
(insert-buffer-substring oldbuf start end)
(dolist (window windows)
(when (= (window-point window) point)
(set-window-point window (point))))))))
------------------------------------------------
The code above is too many function call,I have to check and found about them in Emacs mannual page for a long time,and some of them is a little more hard to understand ,such as (interactive .... function