laurent.orseau
2021-6-11 09:00:41

Does anyone have a nice racket math expression ‘printer’ by any chance? pdf or pict or utf8, or ideally all of these? I want to render something like (+ -1 x (* -1/2 (expt (+ -1 x) 2)) (* 1/3 (expt x -3) (expt (+ -1 x) 3))) ( @soegaard2 )


soegaard2
2021-6-11 09:01:39

racket-cas has an s-expression to tex formatter.


soegaard2
2021-6-11 09:02:25

And I have an tex -> pdf -> pict library too. I’ll find the link.


soegaard2
2021-6-11 09:02:57

soegaard2
2021-6-11 09:05:18

I uses pdflatex to turn the TeX into a pdf - and it also uses a few TeX packages. If you are using TeXLive, they ought to be installed.


laurent.orseau
2021-6-11 09:05:36

Thanks!


laurent.orseau
2021-6-11 09:05:58

I’ll need to convert my s-exp first, but that should be fine.


soegaard2
2021-6-11 09:06:36

I think your example would work fine.



soegaard2
2021-6-11 09:07:22

> (require racket-cas) > (tex '(+ -1 x (* -1/2 (expt (+ -1 x) 2)) (* 1/3 (expt x -3) (expt (+ -1 x) 3)))) "$-1+x-\\frac{1}{2}{(-1+x)}^{2}+\\frac{{(-1+x)}^{3}}{3x^{3}}$"


laurent.orseau
2021-6-11 09:08:27

nice!!


laurent.orseau
2021-6-11 09:08:59

Renders as:


soegaard2
2021-6-11 09:08:59

There is a ton of options to affect the output - but … erm … no documentation, so just ask.


laurent.orseau
2021-6-11 09:09:39

Still a few simplifications are possible. But that’s a hard problem I think


soegaard2
2021-6-11 09:09:40

Where did then (3) come from?


laurent.orseau
2021-6-11 09:10:08

1/3 i guess


laurent.orseau
2021-6-11 09:10:35

> (displayln (tex '(+ -1 x (* -1/2 (expt (+ -1 x) 2)) (* 1/3 (expt x -3) (expt (+ -1 x) 3))))) $-1+x-\frac{1}{2}{(-1+x)}^{2}+\frac{{(-1+x)}^{3}}{{(3)\cdot x^{3}}}$


soegaard2
2021-6-11 09:10:40

But the TeX was: \\frac{{(-1+x)}^{3}}{3x^{3}}$" and the denominator is: {3x^{3}}


soegaard2
2021-6-11 09:10:50

so there should be no parens?


laurent.orseau
2021-6-11 09:11:02

I got a different output


laurent.orseau
2021-6-11 09:11:24

though I haven’t updated racket-cas in a while, let me do that first


laurent.orseau
2021-6-11 09:12:05

there’s a new-format?


soegaard2
2021-6-11 09:12:06

:crossed_fingers:


laurent.orseau
2021-6-11 09:12:47

fixed!


soegaard2
2021-6-11 09:13:08

Ah… I had forgotten that I rewrote the formatter in a different file.


soegaard2
2021-6-11 09:13:30

Yeah, look in new-format.rkt to see the options.


laurent.orseau
2021-6-11 09:14:00

1600+ lines!!


soegaard2
2021-6-11 09:14:25

Well, it’s tricky.


laurent.orseau
2021-6-11 09:16:04

several formats supported too, nice work!


soegaard2
2021-6-11 09:17:50

Hmm. I think (require racket-cas) still exports the old formatter, so maybe use (require racket-cas/new-format) in order to get the new one.


laurent.orseau
2021-6-11 09:20:19

For the sake of completeness: > (require racket-cas/new-format) > (parameterize ([mode 'latex])(displayln (format '(+ -1 x (* -1/2 (expt (+ -1 x) 2)) (* 1/3 (expt x -3) (expt (+ -1 x) 3)))))) $-1+x+\frac{-1}{2}\cdot (-1+x)^2+\frac{1}{3}\cdot \frac{1}{x^3}\cdot (-1+x)^3$


soegaard2
2021-6-11 09:54:03

Hmm. I am not too happy about that output.


laurent.orseau
2021-6-11 09:55:50

the old tex formatter was doing a little better


soegaard2
2021-6-11 10:00:54

Agree. Luckily it is way easier to fix bugs in the new formatter :slightly_smiling_face:


soegaard2
2021-6-11 10:02:17

The initial version of the old formater was only intended to format normalized expressions - and the code looked fine. Then I extended it in a case-by-case manner to support unnormalized expressions too — and suddenly it became a mess.


laurent.orseau
2021-6-11 10:06:22

ouch, I can imagine


sschwarzer
2021-6-11 14:13:30

I see that a <https://pkgd.racket-lang.org/pkgn/package/sudoku-solver|package of mine> has <https://pkg-build.racket-lang.org/server/built/test-fail/sudoku-solver.txt|failing tests> . The <https://git.sr.ht/~sschwarzer/sudoku-solver/tree/main/item/games/sudoku-solver.rkt|file that leads to the error output> is the main program and it (intentionally) complains if the command line doesn’t have arguments. There are no intentional tests in that file.

After seeing the failing tests output, I wrapped the (main) invocation in a (module+ main ...) and updated the package to the latest tag with the presumed fix, but the tests on the package server still fail. The “Last updated” field on the package server is about 20 minutes after I changed the package information to use the new tag.

I wonder what I should change to make the tests pass.


sorawee
2021-6-11 14:24:32

I think “Last updated” is updated means that the package server notices the change. However, to update the result, it will require an actual re-compilation, which is triggered more infrequently. I would wait for a day, and if the result is still not updated, report that the package server is dead.


sschwarzer
2021-6-11 14:28:00

Hm, the current test log output also seems to be after the package update. Do you mean the tests can happen a while after the re-compilation? I had assumed the whole test is actually build and tests together.

That said, if you don’t see a problem with my file, I’ll just wait a bit. :-)


sschwarzer
2021-6-11 14:29:50

I just pushed a new tag because I noticed the version in the info.rkt lagged several versions after the Git tag. :confused: So if you look at my links and tags now, it’ll be even more confusing. :wink: Sorry for that.


sorawee
2021-6-11 14:36:45

What is “current test log output”? How do you know that it “seems to be after the package update.“?

FWIW, https://pkg-build.racket-lang.org/server/built/install/sudoku-solver.txt and https://pkg-build.racket-lang.org/server/built/test-fail/sudoku-solver.txt say that the latest re-compilation happened three days ago.


sschwarzer
2021-6-11 14:58:41

Ouch, I only looked at the time, not the date. :joy: I didn’t know the intervals could be that long.


samth
2021-6-11 15:01:08

The intervals are about 8 hours


sschwarzer
2021-6-11 15:04:48

Yes, it actually makes sense … making more assumptions :wink: , when I entered my package a few days ago, the package server noticed it and then ran the tests. After that, there were no changes to the package until today and my changes from today aren’t detected yet because the end of the current 8-hour interval hasn’t been reached.


greg
2021-6-11 17:31:22

@mflatt Are there conditions under which call-as-atomic might handle an exception in such a way that it ignores the uncaught-exception-handler (and therefore error-display-handler) parameter?


greg
2021-6-11 17:32:15

The context is https://github.com/greghendershott/racket-mode/issues/543#issuecomment-859733422. I’ve been working on this for hours, trying everything I can think of, and even looking at mred and call-as-atomic code (with limited comprehension).


greg
2021-6-11 17:33:18

I definitely don’t want to suck you into this, too. But I wanted to ask in case you had some quick guess or insight. Otherwise no worries.


massung
2021-6-11 17:53:34

When I start up Racket (in DrRacket), and see this right at the beginning: > Language: racket, with debugging; memory limit: 128 MB. What is that “memory limit” supposed to be exactly? Obviously I’m using more than 128 MB of memory, so it must be a specific heap? I’m working on some larger sets of data and it’s constantly dying “out of memory” and asking me to double that limit until it’s okay. Can I easily pre-configure that number to be higher?


greg
2021-6-11 17:54:40

It’s a memory limit for your program.


greg
2021-6-11 17:54:49

Dr Racket runs your program under a custodian.


greg
2021-6-11 17:54:57

Custodians can have memory limits.


greg
2021-6-11 17:55:14

And terminate the program if the limit is exceeded.


soegaard2
2021-6-11 17:55:20

Each tab gets a limited amount of memory. Change the limit in the Racket menu.


soegaard2
2021-6-11 17:55:32

Also … it’s Honu day!


massung
2021-6-11 17:57:46

Ah, I see it now. Thanks.


spdegabrielle
2021-6-11 18:10:08

for larger sets you might want to run from the command line?


mflatt
2021-6-11 18:25:51

I would have to look more when I’m at a keyboard. My default mode (right in many contexts, but maybe not this one) is to assume that an error in atomic mode is fatal with unreliable reporting.


jjsimpso
2021-6-11 19:23:01

Is there a standard way to bundle images(or other resources) with a Racket GUI application? Do I need to create a collection for my app?


samth
2021-6-11 19:24:11

You’ll want to use define-runtime-path to reference the files, and then raco exe and raco dist to create the bundle.


jaz
2021-6-11 21:02:50

I finally pushed code to datetime-lib, datetime-doc, and datetime-test. I also updated the README of the first of these to give some hopefully useful information.


samdphillips
2021-6-11 21:58:32

Does someone have a github action that does close to the same procedure as the build server?


samth
2021-6-11 23:05:31

I think @popa.bogdanp’s setup-racket is close


samth
2021-6-11 23:06:00

You just need to install the package and then test it with raco test


jjsimpso
2021-6-11 23:28:39

@samth, thanks!


samdphillips
2021-6-11 23:39:23

Awesome. I wasn’t sure if there was any special extra —drdr stuff going on.


samth
2021-6-11 23:40:06

You can actually look at the command that runs in the test output


mflatt
2021-6-12 01:08:18

Exceptions during call-as-atomic should be ok. I see that it’s documented that way, and I haven’t detected anything wrong in the implementation along those lines.


sschwarzer
2021-6-12 06:48:30

> You just need to install the package and then test it with raco test As I noticed, in https://git.sr.ht/~sschwarzer/sudoku-solver/tree/main/item/.build.yml I don’t even install the package to run the tests. But I think installing the package with raco pkg install would be a sensible additional task to find installation problems.