S-expressions: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: Added.) |
|||
Line 2,737: | Line 2,737: | ||
((data "quoted data" 123 4.5) (data (! (sys:var #) (4.5) "(more" "data)"))) <- output</lang> |
((data "quoted data" 123 4.5) (data (! (sys:var #) (4.5) "(more" "data)"))) <- output</lang> |
||
However, note that the <code>@</code> character has a special meaning: <code>@#</code> turns into <code>(sys:var #)</code>. TXR's printer right now does not convert this back to <code>@</code> notation upon printing. |
However, note that the <code>@</code> character has a special meaning: <code>@#</code> turns into <code>(sys:var #)</code>. TXR's printer right now does not convert this back to <code>@</code> notation upon printing. (The purpose of this notation is to support Lisp code that requires meta-variables: variables distinguished from variables. For instance, logic pattern matching or unification code. Instead of hacks like name-based conventions (for instance <code>x?</code> is a meta-variable, <code>x</code> is ordinary), why not build it into the language: <code>@x</code> is a meta-var, identifiable by special abstract syntax, and <code>x</code> is just an atom, a symbol. There is also <code>@(foo ...)</code> which expands into <code>(sys:expr foo ...)</code>, doing a similar thing for expressions. |
||
(TODO: A solution will appear here soon which avoids "cheating" in this way: a from-scratch S-exp parser which treats <code>!@#</code> as just a symbol.) |
(TODO: A solution will appear here soon which avoids "cheating" in this way with the built-in parser: a from-scratch S-exp parser which treats <code>!@#</code> as just a symbol. We can beat other languages with our built-in S-exp parser tied behind our back.) |
||
{{omit from|Brlcad}} |
{{omit from|Brlcad}} |