Now, you could of course write an interpreter for such a language in lisp, but am I correct in assuming that there's no reasonable way to get a (standard'ish) lisp to compile an expression like (1:2 ...) to the equivalent caadr(?)-like expression?
I saw there's a library for clojure that adds "slice notation" -- but does so by adding a (slice x y list)-macro which of course is fine -- but it would seem that (x:y list) would give similar benefits to the cadr/cddr etc -- allowing selected subsets to be highly optimized, for example? (As well as offering concise syntax)
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.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://jlongster.com/2012/02/18/its-not-about-macros-its-abo...
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.
http://jtra.cz/stuff/lisp/sclr/mapcan.html
Also linked from the resources-section of:
http://gettingstartedwithcommonlisp.com/
I don't think I've come across the simplified reference before -- appears to be a good resource for those of us starting out with lisp -- striking a balance between all of CLOS and the sometimes simplistic presentation of text books.
A a redirect service for Common Lisp documentation:
A search engine:
Actually on day two of Lisp, fifty years ago, these patterns have been abstracted. Recursion of lists has been replaced by higher-order functions in many cases.
Above maps the function LIST over the two lists and concatenates the results.