Discussion:
New Bie question:How to learn Emacs Lisp in a comfortable way?
(too old to reply)
刘雨桥
2018-06-15 15:59:05 UTC
Permalink
Hi,Everyone ,I have use emacs for several years,unfortunately I do not understand lisp programmed,after reading the book "An Introduction to Programming in Emacs Lisp" for several days,I got a litter tired to understand emacs lisp,any suggestion?

How can I learn emacs lisp in a comfortable way?By the way ,I know C\C++ and Java.
Michael Kallweitt
2018-06-15 18:24:51 UTC
Permalink
Post 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.

In order to learn Emacs Lisp, I'd suggest that you start by reading a
general introduction to the Lisp language to grasp the basic concepts,
and then continue with some manuals or more specialised works on Emacs
Lisp.

It is also a good idea to visit the elisp directory of your Emacs
installation, and try to understand what the .el files in there are all
about.
--
www.wasfuereintheater.com - Neue Theaterprojekte im Ruhrpott
»DAS UNBEKANNTE SCHÖN ZU FINDEN. DEM UNVERSTANDENEN MIT WÄRME ZU BEGEGNEN.
DAS IST WAHRE LIEBE« Barbara Bollwahn, https://www.taz.de/!472086/
Marko Rauhamaa
2018-06-16 09:25:50 UTC
Permalink
Post by Michael Kallweitt
Post 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.

In C and the like, you call a function like this:

f(a, b, 3);

In Lisp, you move the function name inside the parentheses:

(f a b 3)

In C et al, you have traditional, infix expressions:

a * (3 - b / 2)

In lisp, you use a prefix notation, and never drop parentheses:

(* 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
刘雨桥
2018-06-16 15:49:43 UTC
Permalink
在 2018年6月16日星期六 UTC+8下午5:25:54,Marko Rauhamaa写道:
Post by Marko Rauhamaa
Post by Michael Kallweitt
Post 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
James Taylor
2018-07-02 03:27:14 UTC
Permalink
If you're so inclined, ftp.gnu.org still has the introductory elisp
manual under /gnu/emacs. I recommend installing it as a texinfo manual,
then reading it from Emacs. Split the window and open a *scratch* buffer
so that you can follow along with it. It sounds like fun.

James K. Lowden
2018-06-15 23:24:57 UTC
Permalink
On Fri, 15 Jun 2018 08:59:05 -0700 (PDT)
Post by 刘雨桥
How can I learn emacs lisp in a comfortable way?
I read The Structure and Interpretation of Computer Programs (SICP,
https://mitpress.mit.edu/sicp/). It's not about emacs, but then it's
not exactly about Lisp, either. It's a way to learn the concepts from
the ground up. I can't think of a better way.

--jkl
刘雨桥
2018-06-16 07:46:16 UTC
Permalink
Post by James K. Lowden
Post by 刘雨桥
How can I learn emacs lisp in a comfortable way?
I read The Structure and Interpretation of Computer Programs (SICP,
https://mitpress.mit.edu/sicp/). It's not about emacs, but then it's
not exactly about Lisp, either. It's a way to learn the concepts from
the ground up. I can't think of a better way.
--jkl
SICP is a good book, and the schema dialect it uses is also a kind of lisp. However, some of the important contents involved in the emacs lisp are not covered in this book, such as "buffer". Did your point out thar I shall understand SICP all the concept first before learning emacs lisp?
Marko Rauhamaa
2018-06-16 09:13:29 UTC
Permalink
Post by James K. Lowden
On Fri, 15 Jun 2018 08:59:05 -0700 (PDT)
Post by 刘雨桥
How can I learn emacs lisp in a comfortable way?
I read The Structure and Interpretation of Computer Programs (SICP,
https://mitpress.mit.edu/sicp/). It's not about emacs, but then it's
not exactly about Lisp, either. It's a way to learn the concepts from
the ground up. I can't think of a better way.
IMO, SICP is a good way to stifle interest in programming.


Marko
Gene
2018-06-16 17:49:13 UTC
Permalink
Post by 刘雨桥
Hi,Everyone ,I have use emacs for several years,unfortunately
I do not understand lisp programmed,after reading the book
"An Introduction to Programming in Emacs Lisp"
for several days,I got a litter tired to understand emacs lisp,any suggestion?
My suggestion is to start from the position of a generic, common lisp programmer by reading at least the first chapter or 2 of Common Lisp: A Gentle Introduction.
{ref: http://www.cs.cmu.edu/~dst/LispBook/ }

Then, after chapter one, factor in the `Domain specific language' suchness of elisp by supplanting the number-based examples used by Touretsky with text-based examples such as `insert', `concat', `mapconcat' and `split-string' implemented via elisp.
Post by 刘雨桥
How can I learn emacs lisp in a comfortable way?
See below.
Post by 刘雨桥
By the way ,I know C\C++ and Java.
You've put the cart before the horse.
Having been biased by languages pathogenically promotive of Cancer of the Semicolon
{ref: http://uncyclopedia.wikia.com/wiki/Semicolon_Cancer}
the learning of Lisp SHOULD promote a degree of discomfort in the form of cognitive dissonance.

What if cons cells in `programming' are as vital as glial cells to cognition?

What if C-style `pointers' are routinely used at too low a level to allow more-abstract levels of design -- certainly the domain-specific language level -- to ensue without distraction from such minutia ... but the lisp's inbuilt use of singly-linked lists DOES allow and promote high-enough forms of abstract thought to DO domain-specific sorts of activities programmatically?

What if one extrapolates C-style null-terminated character strings into lisp style singly-linked lists?

Why learn elisp when you can learn The Lisps at the same time?
Why not craft symbolic expressions which can be fed to REPLs in common lisp, elisp, scheme and closure in a locked step fashion?
Perhaps even several implementations of scheme: GUILE, chicken, scm, PLT scheme, etc?

Just a few thoughts.
Good luck with your Quixotic Quest.

Gene
刘雨桥
2018-06-18 07:08:45 UTC
Permalink
在 2018年6月17日星期日 UTC+8上午1:49:14,Gene写道:
Post by Gene
Post by 刘雨桥
Hi,Everyone ,I have use emacs for several years,unfortunately
I do not understand lisp programmed,after reading the book
"An Introduction to Programming in Emacs Lisp"
for several days,I got a litter tired to understand emacs lisp,any suggestion?
My suggestion is to start from the position of a generic, common lisp programmer by reading at least the first chapter or 2 of Common Lisp: A Gentle Introduction.
{ref: http://www.cs.cmu.edu/~dst/LispBook/ }
Then, after chapter one, factor in the `Domain specific language' suchness of elisp by supplanting the number-based examples used by Touretsky with text-based examples such as `insert', `concat', `mapconcat' and `split-string' implemented via elisp.
Post by 刘雨桥
How can I learn emacs lisp in a comfortable way?
See below.
Post by 刘雨桥
By the way ,I know C\C++ and Java.
You've put the cart before the horse.
Having been biased by languages pathogenically promotive of Cancer of the Semicolon
{ref: http://uncyclopedia.wikia.com/wiki/Semicolon_Cancer}
the learning of Lisp SHOULD promote a degree of discomfort in the form of cognitive dissonance.
What if cons cells in `programming' are as vital as glial cells to cognition?
What if C-style `pointers' are routinely used at too low a level to allow more-abstract levels of design -- certainly the domain-specific language level -- to ensue without distraction from such minutia ... but the lisp's inbuilt use of singly-linked lists DOES allow and promote high-enough forms of abstract thought to DO domain-specific sorts of activities programmatically?
What if one extrapolates C-style null-terminated character strings into lisp style singly-linked lists?
Why learn elisp when you can learn The Lisps at the same time?
Why not craft symbolic expressions which can be fed to REPLs in common lisp, elisp, scheme and closure in a locked step fashion?
Perhaps even several implementations of scheme: GUILE, chicken, scm, PLT scheme, etc?
Just a few thoughts.
Good luck with your Quixotic Quest.
Gene
Thank you for your answer, let me shine!
I know what to do. Thank you for the materials and ideas you provided. Be grateful!
Loading...