sschwarzer
2021-8-13 09:38:15

In my case, the lists are of length 3, but the first two columns alone determine the order.


sschwarzer
2021-8-13 11:24:03

When I’m thinking of using larger libraries, I wonder how well dead code elimination works. Under section 19.3 in https://docs.racket-lang.org/guide/performance.html\|Performance in the Racket Guide I find: > The bytecode compiler applies all standard optimizations, such as constant propagation, constant folding, inlining, and dead-code elimination. For example, in an environment where https://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29\|+ has its usual binding, the expression (https://docs.racket-lang.org/reference/let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29\|let ([x 1] [y (https://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29\|lambda () 4)]) (https://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29\|+ 1 (y))) is compiled the same as the constant 5. but I wonder what the scope of this dead-code elimination is. I guess the paragraph means that dead code is only eliminated locally, in the just-compiled code.

On the other hand, what happens if I use only a fraction of a larger module or only one module of a large package? Does a binary, created with raco exe --orig-exe, include the whole module or even the whole package?


mflatt
2021-8-13 12:42:09

You’re right that dead-code elimination is local, and raco exe does not change that. For a more global pruning, you could try raco demod, but it has various limitations.


notjack
2021-8-13 20:51:25

Using one module of a larger package should work, though it will include whatever dependency modules it has


notjack
2021-8-14 00:08:40

Anyone know offhand how to read a PostScript file (.ps extension) into a racket object that implements prop:convertible, like a bitmap or pict? The docs have post-script-dc% but that seems to only be for writing to PostScript files, not reading them, and it seems weird that racket/draw would implement writing but not reading.


notjack
2021-8-14 00:09:16

I was hoping read-bitmap would work but it doesn’t seem to support the postscript format


mflatt
2021-8-14 00:34:29

There’s no support for that in racket/draw. Rendering PostScript needs a whole interpreter.


sorawee
2021-8-14 02:30:09

nested exception is really ugly and kinda unreadable. Any solution?


sorawee
2021-8-14 02:30:44

E.g.,

(call-with-exception-handler (λ (e) (raise-argument-error 'hello "number?" "a")) (λ () (raise-argument-error 'world "string?" 1))) produces:

exception raised by exception handler: hello: contract violation expected: number? given: "a"; original exception raised: world: contract violation expected: string? given: 1 a: b: c looks really wrong to me


sorawee
2021-8-14 02:31:22

Would it be feasible to change it to:

exception raised by exception handler: hello: contract violation expected: number? given: "a" original exception raised: world: contract violation expected: string? given: 1 without breaking backward compat?