Category:TXR: Difference between revisions

1,075 bytes removed ,  10 years ago
That will no longer be true in an upcoming release of TXR.
(That will no longer be true in an upcoming release of TXR.)
Line 44:
In TXR Lisp, classic Lisp operations like <code>mapcar</code>, <code>cdr</code> or <code>append</code> work exactly like they are supposed to, when they operate on lists. Right down to improper lists like <code>(append 42) -> 42</code> and <code>(append '(1) 2) -> (1 . 2)</code>.
However, most of the operations have been extended to also work with strings and vectors. So for instance, <code>(mapcar (op + 1) "abc")</code> nicely yields the string <code>"bcd"</code> where <code>1</code> has been added to every character code of the original string. <code>(car "abc")</code> yields <code>#\a</code>, a character, <code>(cdr "abc")</code> yields <code>"bc"</code>, and <code>(cdr "c")</code> yields <code>nil</code> (rather than the empty string!) (Almost) everything proceeds from there.
 
==== One Quote to Bind Them ====
 
TXR Lisp dispenses with the distinction between quoted lists and quasi-quoted lists, in favor of an experiment to combine them. There one quoted syntax denoted by forward quote. This syntax supports unquoting. If you don't unquote anything, you get a regular quote. Splices are not spelled <code>,@</code> because we have had enough of the <code>@</code> character, and because it is ambiguous: does <code>,@x</code> mean "unquote (meta x)" or "splice x?" So the splice operator is denoted by an asterisk. Because there is only one kind of quote, there is some reduction in power in regard to mixing quotes and quasiquotes in one expression due to the ambiguity. The quasi-quote expander contains some hacks to make all the common cases work fine. Notably, the combinations <code>,'form</code> and <code>,*'form</code> (unquote quoted expression and splice quoted expression) are treated specially: the "comma cancels the quote", and so any unquotes inside <code>form</code> do not belong to the inner quote, but to the surrounding quote.
 
==== Good Hackers Borrow; Great Ones Steal ====
543

edits