[racket] How to forbid Racket console to display lists?
You can use void, because by default it's not printed. Another
possibility is to use a "bounded" version of display, that use ...
when the output is too long.
#lang racket
(void (range 1000))
(void (time (range 1000)))
(define (displayln/... x)
(printf "~.a" x))
(displayln/... (range 1000))
;---
Output:
cpu time: 0 real time: 1 gc time: 0
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79 80 81 82 83 84 8...
Gustavo
On Thu, Aug 14, 2014 at 10:42 PM, 楠字数补丁也 <280145668 at qq.com> wrote:
> Version Win 8.1 64bit
>
> Hello, I use "racket.exe [file name]" to execute .rkt file. But sometimes
> when in this situation (just an example easy to explain):
>
> #lang racket
> (range 100000)
>
> The console will automatically display a list of 100000 elements even if I
> don't want to display it.
>
> Some times I just want to know how much time it will take for a function to
> work out a very large list, for example:
>
> (define f <a procedure to form a very large list>)
> (time (f args))
>
> Now in this case, Racket will still try to display the list for you, and you
> will never see the result you want. So, how to forbid Racket console to
> display lists?
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>