
Yep, that works. Thanks!

Can anyone explain what 'maybe
means for prop:custom-print-quotable
?

It affects how structures are printed.

Ah, thanks! I couldn’t find 'maybe
from that page. Perhaps there should be a hyperlink to the page you show above

It says “see <https://docs.racket-lang.org/reference/printing.html?q=prop%3Acustom-print-quotable|The Printer>.” but a direct link to the the paragraph above would be better.

Ahhh, I missed that :face_palm:

Thanks!

Reminder: Racket Users Video Meetup (Saturday, July 3 at 20.00 UTC)


Is it possible to control the number of columns of the output of examples
from scribble/example
? I tried parameterizing print-value-columns
and pretty-print-columns
above the call to make-evaluator
but this didn’t work

#lang scribble/manual
@(require scribble/example
racket/sandbox
racket/pretty)
@(define the-eval
(parameterize ([sandbox-output 'string]
[sandbox-error-output 'string]
[sandbox-memory-limit 50]
[pretty-print-columns 70])
(make-evaluator
'racket/base
#:requires '(racket/string))))
@(examples
#:eval the-eval #:once
(list
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed"
"do eiusmod temporincididunt ut labore et dolore magna"
"aliqua. Ut enim ad minim veniam, quis nostrudexercitation"
"ullamco laboris nisi ut aliquip ex ea commodo consequat."
"Duis aute iruredolor in reprehenderit in voluptate velit"
"esse cillum dolore eu fugiat nulla pariatur.Excepteur sint"
"occaecat cupidatat non proident, sunt in culpa qui officia"
"deseruntmollit anim id est laborum."))

Does something like @examples[#:eval the-eval #:hidden (pretty-print-columns 70)]
work?

I think the parameterize
above doesn’t work because the sandbox will have a new instance of racket/pretty
, with means new parameters. But maybe another way to go is to attach the existing racket/pretty
to the sandbox. You might have to drop down to the racket/sandbox
level to do that.

The first suggestion didn’t work unfortunately

Right, i see why my first attempt failed

Oh, I see why the parameter setting in the sandbox doesn’t matter. The value isn’t being printed, but is being returned from the sandbox as a result, then formatted at the Scribble layer.

I can’t find anything in Scribble to control the output format. is there any?

There’s more information in the documentation of examples
… but if I change your code to use make-base-eval
, then it gets wrapped the way you’d expect. I think that’s because make-base-eval
(instead of working at the racket/sandbox
level) sets up this part for you.

ah, wonderful, that works! Many thanks!

That is, when the documentation for examples
says “the default printer”, it may mean the one for make-base-eval
. If that’s right, then the documentation needs to be improved, of course.

What would be the cause of open-output-file: the current custodian has been shut down
? I’m really confused because this program doesn’t use thread
/custodian
or anything like that and it runs fine on M1, but errors on Linux, very consistently

Oh, I have Racket 8.1 on Linux, but 8.2 on my M1. Could that be the cause? Let me try 8.1 on M1…

Yep. It’s 8.1 vs 8.2

Looks like the documentation is correct, in that “default” really means the default generically. But using make-base-eval
fixes things, because that makes an evaluator with the printer set to pretty-print
(i.e., the printer is not the default one).

@mflatt do you know what could have caused this and/or which commit fixes the problem?

That error by itself doesn’t bring anything to mind.

Yep, it’s my fault. Just found it’s a stale compilation issue