Hello,
I'm trying the proposed solution ('want unlimited depth, but want to avoid
printing the
value of any reference object more than once'). But running into issues:
- clojure.core/print-sequential appears to be private. Solved with (let
[printing-fn #'clojure.core/print-sequential]...
- pr-on does not seem to exist anymore. I assume it functions just as 'pr'
but using a Writer of your own choosing
- *iderefs* got to be ^:dynamic
After that, the print-method for IDerefs can be compiled, but when testing
it on the provided example, I get an
Execution error (StackOverflowError) at java.lang.ThreadLocal/get
(ThreadLocal.java:163).
[#atom[
It appears '[#atom[' printed out is a start of the print-method implemented
by cider.nrepl and I'm still searching in this direction.
Is there an updated solution to this problem (print cyclic refs with
unlimited depth, but avoid printing the
value of any reference object more than once)?
kind regards,
Dieter
On Tuesday, October 1, 2013 at 8:57:56 PM UTC+2 Chouser wrote:
> Bah, mutable state! To be cursed in all its forms!
>
> Here is the same content as was at that paste.lisp.org link. I haven't
> tested it with recent versions of Clojure or anything:
>
> https://gist.github.com/Chouser/6783292
>
> --Chouser
>
> On Tue, Oct 1, 2013 at 12:44 PM, Patrik Sundberg
> <[email protected]> wrote:
> > This paste seems gone - anyone has it available?
> >
> > I seem to get bitten by this kind of thing in emacs using nrepl and it
> > pretty printing something and it gets into an infinite loop locking up my
> > emacs session completely. Running the same from command line i can see
> same
> > behavior (seems related to protocols in my case, but haven't spent much
> time
> > on it(). Either way I'd love to work out a way to avoid the cycles and
> this
> > paste sounds good.
> >
> >
> > On Monday, January 18, 2010 10:21:52 PM UTC, Chouser wrote:
> >>
> >> > On Jan 18, 4:22 pm, Raoul Duke <[email protected]> wrote:
> >> >> hi,
> >> >>
> >> >> hmmm, i wish there were a way (or that it was the default) to tell
> the
> >> >> repl to not continue to loop for ever over things it has already
> >> >> "printed" out when i eval something that is a cyclic thing. anybody
> >> >> have a patch, or thought on this?
> >>
> >> On Mon, Jan 18, 2010 at 4:38 PM, Mark Hamstra <[email protected]>
> wrote:
> >> > See *print-length* and *print-level* in the core API.
> >>
> >> Or if you want unlimited depth, but want to avoid printing the
> >> value of any reference object more than once, you can try this
> >> little thing I hacked together a while ago:
> >>
> >> http://paste.lisp.org/display/83647
> >>
> >> Note that it has to keep a reference to every IDeref object it
> >> sees while it's printing, in order to detect duplicates.
> >>
> >> --Chouser
> >> http://joyofclojure.com/
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to [email protected]
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> --Chouser
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/dbabb537-4557-47a3-9360-9aec93d4aef2n%40googlegroups.com.