4 ms·
Functions like CADDR are not much used in modern Lisp. I would not write `slice` as a `macro` or special syntax. I would use the `SUBSEQ` function, which alrea
by lispm 13y ago
Functions like CADDR are not much used in modern Lisp.
I would not write `slice` as a `macro` or special syntax. I would use the `SUBSEQ` function, which already exists.
CL-USER 7 > (subseq '(a b c d e f) 2 4)
(C D)
The simplest way to introduce a special syntax for it is to use different parentheses:
{1 '(1 2 3 4)} -> 2
But the default Lisp style is this
(functionname arg0 ... argn)
where `functionname` is a real symbol. It may be longer on the character level, which may be a problem for some users - not for me.
- e12e 13y agoI suppose what I was really wondering, but cleverly hid in formulating my comment, was "what are read[er] macros?". That'd be how you could redefine "{" and "}" to work something like this? At least I came across the following that seems to indicate that: http://letoverlambda.com/index.cl/guest/chap4.html http://letoverlambda.com/index.cl/guest/chap4.html http://jlongster.com/2012/02/18/its-not-about-macros-its-about-read.html http://jlongster.com/2012/02/18/its-not-about-macros-its-abo...
- lispm 13y agoReader macros allow you to write parser functions for characters. So you could write a reader macro for { such that it collects all enclosed content until a } character. The it could transform that content and return the transformed result. The result is always Lisp data, not a string. How you transform the enclosed text is up to you. Common Lisp itself tries to minimize its usage of characters. It is expected that users or libraries want to make use of characters like {, }, [, ], and many others.