## digitalmars.D - Limited printing?

- bearophile (17/20) Jan 16 2013 In Mathematica and NumPy (and other systems used with REPL) if
- Nicolas Sicard (2/22) Jan 16 2013 writeln(iota(10_000).take(10)); ?
- bearophile (5/6) Jan 16 2013 You have missed the point. What if you have a [iota(10_000),
- Nicolas Sicard (3/7) Jan 16 2013 OK, but is there a simple and general way to tell how to skip
- Peter Alexander (7/9) Jan 16 2013 I say no. IO isn't always for human consumption (as it usually is
- bearophile (8/12) Jan 16 2013 Mathematica and NumPy on default shorten the output if it's too
- Nicolas Sicard (6/11) Jan 16 2013 A format specifier like this, then, adding width and/or

In Mathematica and NumPy (and other systems used with REPL) if you print a very large array you receive a shortened output. In Mathematica: http://reference.wolfram.com/mathematica/tutorial/ShortAndShallowOutput.html Mathematica uses a representation like (but on default it shows more items. There is a way to print them all): Range[100] {0, 1, 2, <<94>>, 97, 98, 99} While numpy visualization is a bit simpler:array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])from numpy import array array([0] * 10)array([0, 0, 0, ..., 0, 0, 0]) Currently In D this shows all the items: writeln(iota(10_000)); Do you desire some way to have a shortened printing if the generated text is going to be huge? Bye, bearophilearray([0] * 10000)

Jan 16 2013

On Wednesday, 16 January 2013 at 11:16:41 UTC, bearophile wrote:In Mathematica and NumPy (and other systems used with REPL) if you print a very large array you receive a shortened output. In Mathematica: http://reference.wolfram.com/mathematica/tutorial/ShortAndShallowOutput.html Mathematica uses a representation like (but on default it shows more items. There is a way to print them all): Range[100] {0, 1, 2, <<94>>, 97, 98, 99} While numpy visualization is a bit simpler:writeln(iota(10_000).take(10)); ?array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])from numpy import array array([0] * 10)array([0, 0, 0, ..., 0, 0, 0]) Currently In D this shows all the items: writeln(iota(10_000)); Do you desire some way to have a shortened printing if the generated text is going to be huge? Bye, bearophilearray([0] * 10000)

Jan 16 2013

Nicolas Sicard:writeln(iota(10_000).take(10)); ?You have missed the point. What if you have a [iota(10_000), iota(10_000)]? Bye, bearophile

Jan 16 2013

On Wednesday, 16 January 2013 at 11:46:10 UTC, bearophile wrote:Nicolas Sicard:OK, but is there a simple and general way to tell how to skip elements for ranges other than sorted numeric ones?writeln(iota(10_000).take(10)); ?You have missed the point. What if you have a [iota(10_000), iota(10_000)]?

Jan 16 2013

On Wednesday, 16 January 2013 at 11:16:41 UTC, bearophile wrote:Do you desire some way to have a shortened printing if the generated text is going to be huge?I say no. IO isn't always for human consumption (as it usually is in Mathematica). You could very well be printing out as a means of serialisation, and you certainly don't want your data to be trimmed in that case. For a systems programming language, consistency is absolutely critical.

Jan 16 2013

Peter Alexander:I say no. IO isn't always for human consumption (as it usually is in Mathematica). You could very well be printing out as a means of serialisation, and you certainly don't want your data to be trimmed in that case.Mathematica and NumPy on default shorten the output if it's too much large, and show it all on request. What I forgot to say in my first post is that in D it's probably better to have those conditions swapped, this means printing all on default, and adding a way to produce a shorter output on request. Bye, bearophile

Jan 16 2013

On Wednesday, 16 January 2013 at 14:05:03 UTC, bearophile wrote:Mathematica and NumPy on default shorten the output if it's too much large, and show it all on request. What I forgot to say in my first post is that in D it's probably better to have those conditions swapped, this means printing all on default, and adding a way to produce a shorter output on request.A format specifier like this, then, adding width and/or "precision" to "%(": writefln("%10.3(%s, %)", iota(10_000)); // Prints: "0, 1, 2, ... 7, 8, 9". could be useful.

Jan 16 2013