In a Scribble document, is there a way to query the absolute file path of the corresponding .scrbl file?
I realize this might be tricky if a document includes other documents. In my case it’s all in one document, though.
Background of the question: I want to include images with image, but ideally I’d like the paths to be independent of the current directory when I start raco setup. I put the image files in the same directory as the Scribble file.
Depending on the current directory is kind of ok for me locally, but will that also work when the document is built on the package server, i.e. is the then-current directory also the parent path of scribblings?
I think you want define-runtime-path. See the section for the racket/runtime-path module for an overview.
Instrumenting for coverage only happens if you use a C-u prefix for the racket-test command, so just don’t use that prefix?
I’m not certain what you mean by error traces. For the run commands in general, racket-error-context controls whether it gets errortrace style instrumentation to have more details for error message “Context:” displays.
If you mean something else by “error traces” please let me know?
Thank you! I had seen and followed the link to define-runtime-path from the image description, but gave up on understanding the documentation after reading the first one and a half paragraphs. :confused:
I’ve now defined (define-runtime-path scribblings-directory ".") and hope it’ll work. :slightly_smiling_face:
Something that still confuses me:
I had added a @displayln[scribblings-directory] after the above definition and when I ran raco setup, the absolute path was printed, so that looks ok. However, when I run raco setup after that, it doesn’t print the path again.
I thought it may be that after creating the zo files under the compiled directories, Racket might not recompile the Scribble file. But even after removing the compiled directories under my Git root, the path isn’t printed. It’s only printed again if I change and save the scrbl file. (Saving alone isn’t enough.) What’s going on here? :slightly_smiling_face:
I forget how things go exactly, but I think raco setup intercepts output to current-output-port and/or current-error-port, and maybe more so with parallel builds than sequential builds.
In general, because output capture is used for various purposes, find that it works better to use logging for debugging output. For example, I’d write @log-error["~a" scribblings-directory]. It’s not an error, of course, but I use log-error because error-level messages are printed by default.
I wasn’t clear. It looks to me that the c-u prefix for racket-test adds both instrumenting for coverage and better stack trace. I was asking if there is a config to toggle off showing coverage, i.e. make the c-u prefix for racket-test behave the same way it does for other commands, such as racket-run-module-at-point
Is (or value other-value) in place of (if value value other-value) idiomatic Racket? Or would you just use the if form because it’s presumably clearer (apart from the repetition of value)?
It’s idiomatic, though I wish it’s not.
I get your point. :slightly_smiling_face: Do you use something else than the two approaches or would you just use if as shown?
I do use or in Racket, because I think being more idiomatic is more important.
But if I can re-imagine things, I would restrict or for testing, and introduce a new operation for getting “default values”
I know @samth asked for it a while back, so I wrote a blog post about some optimization work I did for Herbie a few weeks ago: https://pavpanchekha.com/blog/optimizing-alt-minimize.html
It does have some of the dead ends edited out.
Not sure if this is a typo:
> which leads to a big speed-up, taking us from 49 seconds to about 48 seconds. That doesn’t look like a big speed-up to me
lol
will fix
I do actually think that the real lever that helped me do the optimization is the little GUI profile explorer I wrote, which itself can really credit Racket’s quite good profile library, which makes it easy to work with profiles.
Ah OK I understand now.
There’s no such option for racket-test now.
But keep in mind that plain racket-test (without the coverage stuff) is effectively the same as doing racket-run-module-at-point with point inside some test submodule. And you could use C-u with that (to get the better errortrace context).
So that would be my suggested hack or work-around, until/unless racket-test gets some enhancement. idk, maybe plain racket-test should just do the errortrace context automatically, as if it set racket-error-context to 'high temporarily. I don’t see a downside; assuming that’s OK that would be straightforward.
Posted on https://lobste.rs/s/orgreu/optimizing_pruning_herbie\|https://lobste.rs/s/orgreu/optimizing_pruning_herbie Dm me your email if you need a lobsters invite
Btw - the trick only works for non-booleans.
Thanks everyone
Found Alex’s blog post: https://alex-hhh.github.io/2019/09/map-snip.html#2019-09-08-map-snip-footnote-2-return
Seems like going the pasteboard way will be easier, even though I quite like the note style of DrRacket. Here’s a gist demonstrating how to go back and forth between the zooming feature and some other overlay: https://gist.github.com/Metaxal/cef7a4a2372aa5b19ddc5c9841cfaaff
Scribble gets a semi-positive mention here: https://buttondown.email/hillelwayne/archive/on-metafiles/