help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One more question about elisp


From: Pascal J. Bourguignon
Subject: Re: One more question about elisp
Date: Sun, 08 Nov 2009 17:01:06 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

Francis Moreau <address@hidden> writes:

> address@hidden writes:
>
> [...]
>
>>
>> You have been pointed to "defstruct" already. From it info page:
>
> I realized this is not part of elips but clisp, that's why I missed it.

There is no programming language named clisp.

There is one named Common Lisp, which has several implementations, one
of which is called clisp.  But "clisp" is not the name of a
programming language, it's the name of a program.


> The weird thing (for now) is that "defstruct" is not very used in the
> source code of emacs.
>
> Anyway, I'll keep trying to learn the basic concept of elisp.

THE basic concept of all the languages in the lisp family, is that of
the uniform syntax for data and code (symbolic expressions, sexp).

This allows to easily write programs to transform programs, since
programs are normal lisp data.  Hence the notion of macro.

This allows to easily extend the language to fit your needs, since the
new operators you can implement with macros are indistinguishable from
primitive operators.


Apart from that, the exact primitive data types provided by a lisp
system is rather irrelevant, given a few user level libraries
providing the macros needed to define data abstractions you want.  And
if these libraries don't exist, no problem, you can easily write them
yourself.  In anycase, in a sizeable lisp program it is expected that
you write yourself your own macros to define your own, application
specific, language.


So, yes, structures don't exist in the bare emacs lisp language.  But
this doesn't matter, since there is the cl package that provides a
defstruct macro.  If this package didn't exist, it wouldn't matter
either, since you could easily write such a defstruct macro yourself.

And in any case it doesn't matter, since in your application you'll be
expected to define your own macro to define your own entities. (You
may base your macro on defstruct, or you may base it on lower level
emacs lisp vectors, or on cons cells, or whatever, it just does not
matter).


Read SICP!

         Structure and Interpretation of Computer Programs
         http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html
         http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/
         
http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages
         http://eli.thegreenplace.net/category/programming/lisp/sicp/
         http://www.neilvandyke.org/sicp-plt/

-- 
__Pascal Bourguignon__


reply via email to

[Prev in Thread] Current Thread [Next in Thread]