From ... From: Erik Naggum Subject: Re: [constants] from a reader macro Date: 2000/02/24 Message-ID: <3160383123856271@naggum.no>#1/1 X-Deja-AN: 589325457 References: <3160367893782736@naggum.no> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 951403634 16132 195.0.192.66 (24 Feb 2000 14:47:14 GMT) Organization: Naggum Software; +47 8800 8879 or +1 510 435 8604; fax: +47 2210 9077; http://www.naggum.no User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 Mime-Version: 1.0 NNTP-Posting-Date: 24 Feb 2000 14:47:14 GMT Newsgroups: comp.lang.lisp * Erik Naggum | it seems by your use of the backquote that your core confusion is to | believe that "macro" in "reader macro" is the same kind of "macro" as in | "macro function". it isn't. * Tunc Simsek | I must confess that I don't understand this remark, they behave in the | same way, their ranges are lisp code. no. that's the issue. the "range" of macros is Lisp code which will be processed by the caller, usually the compiler on code it processes. the "range" of reader macros is Lisp objects the Lisp reader was asked to pick up from some textual input source, such as by the compiler when it compiles files. viz, a macro to build a matrix would return the code to be evaluated or compiled instead of the macro form, while a reader macro to build a matrix would return the matrix as a constant object. moreover, they do not behave in the same way. a macro function is called with Lisp code it can transform at will, while a reader macro is expected to build Lisp objects from parsing input. the "domain" of the former is Lisp objects and code, while the "domain" of the latter is characters and streams. this must be understood in depth before you can make use of reader macros productively. most Lisp programmers don't know how the Lisp reader and printer work to begin with, or how to add new objects to the read-write-consistency paradigm. indeed, not understanding how Lisp has solved this very difficult problem is why most designers of protocols and syntaxes get them so incredibly wrong. | My intent is to get a simple way of expressing constant matrices which I | use a lot and don't like to type in (make-matrix ... all the time. this is good. however, you should regard your reader macro as a short-cut for #.(make-matrix ...), not for (make-matrix ...) if you want to build the matrix in the reader macro (and nothing else makes sense). | I actually know of one problem with using #\[ as a macro character: | allegro uses it as a super paranthesi. which "allegro" is that? Allegro CL does not violate the standard by interpreting [ and ] as anything but ordinary symbol name constituents. #:Erik