Re: REPL: viewing data structures containing infinite lists
If you're using cider (https://github.com/clojure-emacs/cider), there's a convenience function for controlling the value of *print-length*, including giving it a default value for new nrepl instances: https://github.com/clojure-emacs/cider#limiting-printed-output-in-the-repl /Ragnar On Tuesday, 1 April 2014 01:49:57 UTC+1, Christopher Howard wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
Andy mentioned files, but yes, in a pipe this is true. Still, it's not true on the REPL; I can't think of an obvious use case there, and if there is one then having the programmer work around something like *interactive-print-length* would be reasonable. Note that we are talking about an infinite data structure here, not an infinite loop. As a specific example, say we wanted to produce a /dev/random like command, you would not achieve this by printing an infinite random list because you'd get a ( a the beginning which was never closed. You'd loop. So, this would not be affected by a limit on the size of a single data structure. Gary Trakhman gary.trakh...@gmail.com writes: It's possible for an infinite print to be just fine, it's a streaming API after all, consider invoking a clojure program in the middle of some unix pipes. On Tue, Apr 1, 2014 at 12:58 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: Of course, in this circumstances, infinitely long lists are not going to behave well either. But, it seems to me, that this is (or should be) independent of interactive use in the REPL. The current behaviour is never nice. Probably, there needs to be a *interactive-print-length* var or equivalent. Andy Fingerhut andy.finger...@gmail.com writes: One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.com wrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit
Re: REPL: viewing data structures containing infinite lists
kovas boguta kovas.bog...@gmail.com writes: Chalk this up as another cautionary tale about global singletons. It's dynamic, so it can be bound for a repl thread! What we need is a parameterizable write-edn function, mirroring the already extant read-edn. The function should guarantee it will either write valid EDN, or throw an exception. It should also take as an argument a map that allows one to specify the printing function for any datatype. I think this makes sense as well. On casual reading it's not at all obvious why clojure.edn has a read function but no write. With write-edn out of the way, we need a similar function optimized for printing forms at the repl (with no guarantee that its output is itself readable), and make it the default for the various repls. Agreed. Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
Maik Schünemann maikschuenem...@gmail.com writes: There is real no sensible default value rather than the current. I would say that there is no sensible default value *including* the current. Certainly at REPL usage, the current value is probably the least sensible. My sensible default is 32. Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.eduwrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
I'd be interested in knowing this as well. Lots of tutorials have things like (take 10 (range)) followed by statements that range on it's own will break your REPL. Seems to me a common gotcha for Clojure. Phil Andreas Liljeqvist bon...@gmail.com writes: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.eduwrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
On Tuesday, April 1, 2014 11:00:37 AM UTC-5, Andreas Liljeqvist wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. For the lein REPL, merge this into your ~/.lein/profiles.clj {:user {:repl-options {:init (set! *print-length* 42)}}} -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
Yea, print is generalized to a java PrintWriter class, I think, the requirements of repl usage are not the only ones. On Tuesday, April 1, 2014, A. Webb a.webb@gmail.com wrote: On Tuesday, April 1, 2014 11:00:37 AM UTC-5, Andreas Liljeqvist wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. For the lein REPL, merge this into your ~/.lein/profiles.clj {:user {:repl-options {:init (set! *print-length* 42)}}} -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.comjavascript:_e(%7B%7D,'cvml','clojure@googlegroups.com'); Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comjavascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com'); 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 clojure+unsubscr...@googlegroups.comjavascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com'); . For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
Of course, in this circumstances, infinitely long lists are not going to behave well either. But, it seems to me, that this is (or should be) independent of interactive use in the REPL. The current behaviour is never nice. Probably, there needs to be a *interactive-print-length* var or equivalent. Andy Fingerhut andy.finger...@gmail.com writes: One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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
Re: REPL: viewing data structures containing infinite lists
It's possible for an infinite print to be just fine, it's a streaming API after all, consider invoking a clojure program in the middle of some unix pipes. On Tue, Apr 1, 2014 at 12:58 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: Of course, in this circumstances, infinitely long lists are not going to behave well either. But, it seems to me, that this is (or should be) independent of interactive use in the REPL. The current behaviour is never nice. Probably, there needs to be a *interactive-print-length* var or equivalent. Andy Fingerhut andy.finger...@gmail.com writes: One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.com wrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to
Re: REPL: viewing data structures containing infinite lists
There is real no sensible default value rather than the current. But for me the current behaviour is no problem, just C-c C-c to interrupt evaluation (at least in cider) On Tue, Apr 1, 2014 at 7:02 PM, Gary Trakhman gary.trakh...@gmail.com wrote: It's possible for an infinite print to be just fine, it's a streaming API after all, consider invoking a clojure program in the middle of some unix pipes. On Tue, Apr 1, 2014 at 12:58 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: Of course, in this circumstances, infinitely long lists are not going to behave well either. But, it seems to me, that this is (or should be) independent of interactive use in the REPL. The current behaviour is never nice. Probably, there needs to be a *interactive-print-length* var or equivalent. Andy Fingerhut andy.finger...@gmail.com writes: One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- You received this message
Re: REPL: viewing data structures containing infinite lists
Chalk this up as another cautionary tale about global singletons. There can be only one print-method, yet we have two conflicting use cases: repl interaction, and data transport. What we need is a parameterizable write-edn function, mirroring the already extant read-edn. The function should guarantee it will either write valid EDN, or throw an exception. It should also take as an argument a map that allows one to specify the printing function for any datatype. I've taken a stab at this in my merchant library (https://github.com/kovasb/merchant), one of the yaks I shaved for session. I haven't announced/documented it, but someone who really needs a solution might be interested to know it exists. It also provides a sane way to deal with tagged literals. With write-edn out of the way, we need a similar function optimized for printing forms at the repl (with no guarantee that its output is itself readable), and make it the default for the various repls. On Tue, Apr 1, 2014 at 1:24 PM, Maik Schünemann maikschuenem...@gmail.com wrote: There is real no sensible default value rather than the current. But for me the current behaviour is no problem, just C-c C-c to interrupt evaluation (at least in cider) On Tue, Apr 1, 2014 at 7:02 PM, Gary Trakhman gary.trakh...@gmail.com wrote: It's possible for an infinite print to be just fine, it's a streaming API after all, consider invoking a clojure program in the middle of some unix pipes. On Tue, Apr 1, 2014 at 12:58 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: Of course, in this circumstances, infinitely long lists are not going to behave well either. But, it seems to me, that this is (or should be) independent of interactive use in the REPL. The current behaviour is never nice. Probably, there needs to be a *interactive-print-length* var or equivalent. Andy Fingerhut andy.finger...@gmail.com writes: One argument for default value of *print-length* being nil: Plenty of people print Clojure data structures to files and later read them back in. The data would be corrupted if *print-length* was a too-small numeric value for your particular data. It might not be obvious until much later that you have lost data. Andy On Tue, Apr 1, 2014 at 9:00 AM, Andreas Liljeqvist bon...@gmail.com wrote: Is there any good reason for not providing a default value for *print-length*? I think that if you *really* want to print a list containing 100K items, you would have to set *print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.comwrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.edu wrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are
REPL: viewing data structures containing infinite lists
Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: REPL: viewing data structures containing infinite lists
http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard cmhowa...@alaska.eduwrote: Is there some kind of safe function for printing representations of lazy, infinite data structures? I'm finding I like using them inside other data structures here and there. However, when I go to play around with things in the REPL, sooner or later my workflow is interrupted by 3 million characters streaming across the console. I don't imagine there would be any way for the REPL to detect that a lazy sequence was infinite. However, if it would simply refuse to evaluate lazy sequence (say, represent them by some special identifier) that would be good enough for me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.