Antireader macros
Re: Antireader macros
It's user's arbitrariness (like *print-circle* etc.).
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
Re: Antireader macros
Just spinning my wheels here, what about defining a type or class that's instantiated when the reader encounters curly-braces, possibly a subclass/subtype of list, and specialising print-object on that type/class?
Note: this is based on exactly zero fact-checking, combined with a sketchy grasp of CL's type system.
Note: this is based on exactly zero fact-checking, combined with a sketchy grasp of CL's type system.
Re: Antireader macros
A) - I don't mind that I'm going to lose information during a reading part.sylwester wrote:A) only curlies in place of parenthesis everywhere?
B) mixed curlies and parenthsis?
The reader macro is more generic actually it's for differently written lists, no special structure, so I would say that doesn't fit.JamesF wrote:Just spinning my wheels here, what about defining a type or class that's instantiated when the reader encounters curly-braces, possibly a subclass/subtype of list, and specialising print-object on that type/class?
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
Re: Antireader macros
So I'm probably blind and possibly set-pprint-dispatch will be sufficient.
Here is a simple solution for my factitious problem, although it deals bad with a syntactic sugar like quote, quasiquote, unquote, etc.
// I wonder you haven't kicked me to read the documentation properly.
And now I'll see how good is it for cl-2dsynax.
Here is a simple solution for my factitious problem, although it deals bad with a syntactic sugar like quote, quasiquote, unquote, etc.
Code: Select all
(set-pprint-dispatch '(cons t t)
#'(lambda (s input) (format s "{~{~s~^ ~}}" input)))
And now I'll see how good is it for cl-2dsynax.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
-
- Posts: 61
- Joined: Mon Jul 07, 2008 8:06 pm
- Location: Toowoomba, Queensland, Australia
- Contact:
Re: Antireader macros
Good pickup - I just found 22.2.1.4 Pretty Print Dispatch Tables. Interestingly, I've never seen anyone use it (although that's not saying much
). Nice!
