Welcome! Please see the About page for a little more info on how this works.

0 votes
in Printing by

`
(with-out-str
(with-pprint-dispatch code-dispatch

                    (pp/pprint (read-string "(fn* [x] x)"))))

`

breaks because the format string here: https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj#L378 expects a sequence. In the case of (fn* (link: x) x) it is passed a symbol.

2 Answers

0 votes
by

Comment made by: hypirion

I think the main "issue" here resides within the undocumented functionality of fn. (fn (link: x) x) is a semantically working function, but (fn (link: x) x) expands into (fn ((link: x) x)). Anonymous function literals expand into (fn (link: gensyms) (...)), and as such, it also accepts expressions like (fn (link: x) x). Should pprint pretty print expressions which has used fn directly, or should it "just" ignore it?

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1181 (reported by devn)
...