Re: [q-lang-users] Request to add new reserved words "quote" and "QUOTE" to Q
Brought to you by:
agraef
From: John C. <co...@cc...> - 2006-05-16 15:13:17
|
Albert Graef scripsit: > Well, I'm all for a Lisp interface, My intention is to write an "egg" (library package) for Chicken Scheme, an implementation of Scheme that compiles into C. It will provide access to the libqint facilities, but there will also be an upper layer that converts a Scheme datum to a qexpr and vice versa, so that Q expressions can be conveniently constructed using native Scheme facilities. However, I would want there to be just one S-expression representation of Q so that interfaces for other Scheme/Lisp implementations could be constructed in future. By the way, libqint does not appear to expose any mechanism for setting and getting the values of free variables, for implementing something like the Q interpreter's "def". How should this be done? Can you add some appropriate calls? > but I don't like the idea to > introduce some special keywords which aren't even used in the language. > If the issue is just to disambiguate the s-exp representation, why can't > this be done with a Lisp macro, say "q-list", which can't possibly occur ? I was primarily going for the familiarity and convenience of the ' read-macro on the Lisp side: the Lisp user can write an familiar-looking S-expression like (++ '(1 2 3) '(4 5 6)) to represent [1,2,3] ++ [4,5,6]. On reflection, though, the idea's not such a good one, because the result would have to be (quote (1 2 3 4 5 6)) to signal that it was a list and not an application being returned. Stripping this "quote" off would be very annoying. Lisp lists and Q lists are conceptually identical and should be smoothly interchangeable. So I withdraw the request. Instead, I'll go for using some un-Q-ish token to indicate an application, such as (q-call ++ (1 2 3) (4 5 6)). > Or maybe it would be possible to escape Q function > symbols? (I'd say that you need an escape mechanism on symbols anyway, > if only to distinguish "foo" from "FOO" which are the same symbol in > Lisp, right?) The position is this: In Common Lisp, the symbol foo may be "foo" or "FOO" at the implementation's option. The user can get control by writing |foo| or |FOO|; the same mechanism allows otherwise illegal symbols like |'| and |()|. The current Scheme standard (R5RS) officially is case-insensitive and has no such vertical bars, but the majority of Scheme implementations are case-sensitive, use lower-case internally -- that is, (if #t 1 2) works but (IF #T 1 2) does not -- and support vertical bars. The next Scheme standard will be case-sensitive, lower-case for standard symbols, and will allow bars. So the only issue is what symbol the read-macro ' generates (it's functionally the same in Scheme and CL); it could be either QUOTE or quote, but is much more likely to be the latter, especially in Scheme. But none of this matters for this discussion. -- Her he asked if O'Hare Doctor tidings sent from far John Cowan coast and she with grameful sigh him answered that http://ccil.org/~cowan O'Hare Doctor in heaven was. Sad was the man that word co...@cc... to hear that him so heavied in bowels ruthful. All she there told him, ruing death for friend so young, James Joyce, Ulysses algate sore unwilling God's rightwiseness to withsay. "Oxen of the Sun" |