Post #131,197
12/17/03 11:22:40 AM
|
Peter's point is that you need to learn basic English
My recommendation for a real Lisp book is, The Structure and Interpretation of Computer Programming. But I'm sure that you'll hate it, so don't bother.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #131,499
12/19/03 10:30:41 AM
|
Besides, it's no good for a quick emacs hack
Which is, I bet, what Mr. T is after.
What he wants is [link|http://www.delorie.com/gnu/docs/elisp-manual-21/elisp_toc.html|GNU Emacs Lisp Reference Manual]. Simpler than Oracle User's Guide. But is it simple enough?
--
"It\ufffds possible to build a reasonably prosperous society that invests in its people, doesn\ufffdt invade its neighbors, opposes Israel and stands up to America. (Just look at France.)"
-- James Lileks
|
Post #131,503
12/19/03 10:55:38 AM
|
Answering the last question...
Wrong question. The right one is whether it will make Lisp match Bryce's expectations. Since Lisp doesn't match his expectations, and Lisp isn't about to change, he'll not like it. No matter how simple it is.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #131,881
12/22/03 2:37:03 PM
|
But isn't LISP the ideal language to rewrite LISP in? :-)
________________ oop.ismad.com
|
Post #132,234
12/24/03 5:54:50 PM
|
Yes, but it is still Lisp
I'll give you a quick overview for the original question.
Lisp data structures (with a very small number of counter-examples) look like (operator argument1 argument2). Operators come in two basic forms, function calls and macros. A function call just calls the function named operator with the appropriate arguments and does something. A macro takes the arguments, and returns some data structure which is evaluated in turn. That data structure will again look like (operator argument1 argument2) although after the rewrite you generally have a different operator and different arguments.
Normally within parentheses each word is a different symbol, case insensitive. So operator actually might be OPERATOR internally, and will be printed that way if you ask the interpreter to print it. Double-quotes give you quoted strings, from which you can generate normal text like "Hello".
And in one of the few pieces of syntactic sugar in Lisp, 'foo is rewritten by the interpreter to mean (quote foo). Which gives you back the symbol foo directly, which is appropriate for passing into or out of functions and macros.
You are beginning to undersand Lisp when it is obvious to you when you can't write foo instead of 'foo (or long-hand, (quote foo)) because Lisp will immediately interpret foo as an operator and try to call it as a macro or a function immediately, rather than inserting it into the data structure that you are trying to return.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #133,296
1/2/04 5:32:01 PM
|
double quotes
Okay, but I still don't get the difference between:
'(foo bar)
and
"(foo bar)"
________________ oop.ismad.com
|
Post #133,314
1/2/04 7:55:09 PM
|
Datastructure vs string
'(foo bar) is a potentially complex data structure, while "(foo bar)" is a simple string.
It might be easier for you to understand if you translate it into another language. In Perl '(foo bar) would be written [$FOO, $BAR] (the capitals are to illustrate how Lisp is case-insensitive), while "(foo bar)" is the same in either language.
Does that make sense?
Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #134,198
1/8/04 12:17:28 AM
|
Okay, I think I got it.
I suppose it is a "Lisp structure", which is basically a "pointer" version of Lisp code. Is there a way to turn a string into such a structure?
BTW, is Emacs-Lisp considered a "decent" Lisp? Stripped-down Lisp?
________________ oop.ismad.com
|
Post #134,303
1/8/04 1:49:19 PM
|
More answers
To turn a string into a data structure you could use eval. You shouldn't have to do that very often though, because with macros and functions you can do what you might otherwise want to do with eval, and do it more cleanly.
As for eLisp, it is an older Lisp. It predates the acceptance of lexical scope, and so doesn't support things like closures. In my eyes that makes it a inferior, but YMMV.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|