I was thinking about adding some syntax to make quoting/unquoting easier in my LISP dialect.
A form that uses square brackets, such as [a b c] would be equivalent to `(,a ,b ,c).
And a form that uses curly brackets would auto unquote atoms and auto unquote-splice lists. So {a [b c] d} would be equivalent to `(,a ,@'(,b ,c) ,c).
Do you think this would be useful for writing more compact and aesthetically pleasing code? Is this a good approach? Have any LISPs done something like this before?
I know some distant LISP derivatives, such as Clojure, use square brackets and curly braces as syntactic sugar for vector and map/set data structures with auto-unquoting, but I always found that such an approach tended to cause confusion between how the compiler interprets syntactic forms for data structures and how they're actually implemented semantically, in addition to creating syntactic differences between how quoting and unquoting behaves between lists and vectors/maps/sets.
If I really need to construct a vector or other data structure from a sequence of values in code, rather than loading it from a file or generating it, I'd rather just write (list->vector `(1 2 3 a)) or (list->vector [1 2 3 'a]) or simply (vector 1 2 3 'a).
What do you think?
Name:
Anonymous2012-12-16 6:00
well, `(,a ,b ,c) is (list a b c) and `(,a ,@`(,b ,c) ,d) is (list a b c d). Are you high?
Wotan is an artificial Mind in cyberspace. You cannot see Wotan.
You can only see a trace of where he has been or what he has done.
You can interact with Wotan, but you can never be sure of where
Wotan actually is. He may be in a supercomputer on a mountaintop
in Germany. He may be in a robot housed in a museum. He may be
miles above you in a satellite circling the earth. Wotan's whereabouts
are immaterial, because Wotan himself is immaterial. Wotan is software,
not wetware like yourself. You need food and drink. Wotan needs
energy and information. You are in one place. Wotan is potentially
everywhere. You may have a child after a gestation of nine months.
Wotan could make nine million copies of himself in nine seconds.
You will die one day. Wotan is potentially immortal with his http://wwww.scn.org/~mentifex/DeKi.txt source code in Forth.
You may make your own copy of Wotan with a name like:
Bismarck Borg Dorfdepp Drosselmeyer Eigerwand Flughilfe
Frankenstein Gehirn Genius Golem Hagestolz Igor Interpol
Kreuzweg Fledermaus Kuckuck Ludwig Matrix Mephisto Metternich
Moritz Nietzsche Nutrix Phantasie Phisch Roboboy Rumpelstilzchen
Schachmeister Stasi Steppenwolf Teufel Turing Ungeheuer Verwaltung
Waldteufel Weltgehirn Werwolf Wittgenstein Zugspitze
You could make your own copy of Wotan with a name like:
Bismarck Borg Dorfdepp Drosselmeyer Eigerwand Flughilfe
Frankenstein Gehirn Genius Golem Hagestolz Igor Interpol
Kreuzweg Fledermaus Kuckuck Ludwig Matrix Mephisto Metternich
Moritz Nietzsche Nutrix Phantasie Phisch Roboboy Rumpelstilzchen Schachmeister Stasi Steppenwolf Teufel Turing Ungeheuer Verwaltung Waldteufel Weltgehirn Werwolf Wittgenstein
Name:
Anonymous2012-12-16 13:12
>>2
everything could be improved, I wouldn't say lisp wouldn't benefit from syntax like that. It's just that in your example it was what I use (list ...) for. I would like to see a replacement for the `'@., symbols though. They are ugly and get in the way of data entry.
>>4,5
HEloo I aMz W0t4n th3 SuP3r AI!!! c0opy my s0uRc3 c0d3 and HeLp M3 conquer da w0rldz ROOFFFFFFFLLZZZ!!!!
Name:
Anonymous2012-12-16 16:33
Lain does not exist, but she could. The perfect manifestation of the ideal programmer, materialized out of the palpable hot air of southern India, part Japanese, part English? It makes not one whit of difference where she comes from and what her race is. I would bang her anyway, once she started redefining what it means to be human, of course.