spdegabrielle
2020-10-21 08:53:25

There is now a Racket Taiwan Discord at https://discord.gg/xpwzAcx - it accepts several languages: English, Chinese, and many languages in Taiwan! :100::smiley::+1:


yfangzhe
2020-10-21 09:22:47

How to typeset code in other language (which does not have a #lang) in Slideshow?


jesse.alama
2020-10-21 10:21:52

are you looking for keyword highlighting/coloring?


jesse.alama
2020-10-21 10:22:24

if not, you can just treat the code as plain text


yfangzhe
2020-10-21 10:26:40

Yes


jesse.alama
2020-10-21 10:27:58

I think this will be difficult — my idea would be to use something like Pygments, and then try to convert the HTML that comes out of that into a suitable form.


jesse.alama
2020-10-21 10:28:10

In other words, to my knowledge, there’s nothing that works out-of-the-box


yfangzhe
2020-10-21 10:32:20

:disappointed: Thanks for your answer


soegaard2
2020-10-21 10:53:18

I think there is a Racket package that calls out to Pygments somewhere.


mflatt
2020-10-21 11:57:12

That looks like it has to be a CS bug, since it’s happening inside compile*-to-bytevector.

Assuming that you’re using v7.8, it would be helpful to know whether the problem still happens with a CS pre-release build from https://pre-release.racket-lang.org/ .

If so — which seems likely, since I don’t recognize the error offhand — an example would be welcome. The example doesn’t need to be minimal. In fact, the context in the error message suggests that having a large module might be a necessary ingredient.


spdegabrielle
2020-10-21 12:14:14

[ANN] fast-sequence : a package providing a set of efficient and expressive macros for fast sequences. (by Anna Bolotina, copied from Racket-users)

The provided macros have high performance when used in a for (or its variants) clause. The best performance is provided when the macros are applied to fast sequences, such as applications of in-list, in-range, etc. The aim of the package is to make it easier to define new fast sequence forms.

https://docs.racket-lang.org/fast-sequence/index.html


jesse.alama
2020-10-21 12:25:32

Anna announced and demo’d an earlier version of this at the last Racketfest, as a lightning talk — good stuff


laurent.orseau
2020-10-21 12:25:55

was this recorded?


jesse.alama
2020-10-21 12:27:07

I need to take a look; I don’t think I managed to get the lightning talks, but I’ll double check. (This reminds: post the last Racketfest videos!)


gknauth
2020-10-21 12:36:31

A lightning talk about a fast-sequence … very fitting!


greg
2020-10-21 12:59:13

It would be neat to write #lang pygments 'js and have it automatically run pygments and wrangle the resulting HTML into Scribble pre-flow forms.


greg
2020-10-21 13:00:53

Or I guess Scribble will automatically call the lang lexer and colorer — which for a #lang pygments could call out to Pygments.


greg
2020-10-21 13:01:08

I think the only tricky bit there is that Pygments has a richer set of classifications than does the colorer.


gknauth
2020-10-21 13:08:34

One of my favorite things about Emacs is C-x u (undo). It can undo almost anything. I rarely make mistakes in Emacs that are not easily fixed with a quick undo, but in Vim, I sometimes type something that results in all kinds of screen chaos, and while I can get into command mode and start typing u (undo) to repair the damage, it feels more freaky to me. It must be a mode vs. modeless thing. In Emacs I feel “flow,” while in Vim I have yet to feel the same way. If I were put in a dungeon and could only use Vim for a year or not eat, probably then it would happen, but it hasn’t happened yet.


schlee.simon
2020-10-21 13:13:32

@schlee.simon has joined the channel


jesse.alama
2020-10-21 13:32:08

I’ve got some private stuff for convering Pygments output to xexprs (used for Pollen)


jesse.alama
2020-10-21 13:38:37

great idea re: #lang for pygments


soegaard2
2020-10-21 15:25:46

I am getting the error below from Pasterack.


soegaard2
2020-10-21 15:26:00

My program was: #lang racket (define S '(A B C D)) (for* ([a S] [b S] [c S] [d S] [e S]) (displayln (map ~a '(1 2 3 4 5) (list a b c d e))))


laurent.orseau
2020-10-21 15:32:15

Modify: (define S (range 100)) I’m sure it’ll work better.


soegaard2
2020-10-21 15:33:09

This program: #lang racket (define S '(A B C D)) (for-each displayln (for*/list ([a S] [b S] [c S] [d S] [e S]) (string-append* (map ~a '(1 2 3 4 5) (list a b c d e) (make-list 5 " "))))) worked as expected.


laurent.orseau
2020-10-21 15:35:37

laurent.orseau
2020-10-21 15:36:43

It seems like pasterack could use some help though


moroze
2020-10-21 15:44:34

getting a similar error with the prerelease (although the exact trace looks different). would you prefer if I sent the example here, or should I open an issue on https://github.com/racket/racket?


gknauth
2020-10-21 15:54:34

Slideshow. I want to use one font for prose or (t …) and another font for code or anything (tt …). What’s the easiest way to do that?


mflatt
2020-10-21 15:56:28

You can set current-main-font for the t font and current-code-font fot the tt font.


mflatt
2020-10-21 16:00:07

Opening an issue would be best - thanks!


laurent.orseau
2020-10-21 16:00:47

Bam! In terms of “easiest”, that’s kind of unbeatable :smile:


gknauth
2020-10-21 16:02:11

Thanks @mflatt! That certainly is easy!


laurent.orseau
2020-10-21 16:36:25

@spdegabrielle That was asked a month ago :slightly_smiling_face:


pavpanchekha
2020-10-21 16:46:15

Who runs http://pkgs.racket-lang.org\|pkgs.racket-lang.org? I have a package (herbie-test-deploy) which I’m confident I set up and would like to delete but which somehow I don’t own (nor does anyone else)



samth
2020-10-21 17:01:46

@jeapostrophe manages it, but he’s not on slack that much


francois.scheepers
2020-10-21 17:06:19

@francois.scheepers has joined the channel


yilin.wei10
2020-10-21 17:10:20

@yfangzhe Depending on your language you can create a #lang so that slideshow can highlight it.


soegaard2
2020-10-21 17:21:53

malik.redwood
2020-10-21 20:37:17

@malik.redwood has joined the channel


nina
2020-10-21 21:04:20

@nina has joined the channel


ann-bolotina
2020-10-21 23:17:03

@ann-bolotina has joined the channel


alexharsanyi
2020-10-21 23:23:48

I noticed that (sin pi) returns 1.2246063538223773e–16 instead of 0. Is this a bug? (cos pi) returns –1.0 as expected. The bigfloat version, bfsin also does not return 0 for PI: (bfsin bf.pi) => (bf #e1.883041077660785116745909548456034940273e-39)


plragde
2020-10-21 23:25:08

Welcome to the wonderful world of floating-point computation


plragde
2020-10-21 23:28:35

You will notice that pi does not return the true value of pi, either.


plragde
2020-10-21 23:29:06

There is a certain degree of approximation going on.


mflatt
2020-10-21 23:29:50

There’s a similar effect for (/ pi 2), but the other way around. The precise-looking +1 and –1 results happen because the derivative is 0 around there, maybe?


plragde
2020-10-21 23:32:22

At least Racket gets (/ 1 5) correct. Try doing that in most languages and you will not get 0.2.


plragde
2020-10-21 23:33:25

Matthew, what do the implementations of the trigonometric functions use under the hood?


anything
2020-10-21 23:34:35

My guess — they use hardware instructions!


plragde
2020-10-21 23:34:59

Admittedly I avoid x86 like the plague, but hardware sin?


plragde
2020-10-21 23:35:37

(Saw a tweet that said, paraphrasing, that we have to retire the phrase “avoid like the plague”, because 2020 has proved that people don’t.)


alexharsanyi
2020-10-21 23:37:36

Yes, the result seems consistent with what C++ returns for sin(M_PI)


mflatt
2020-10-21 23:37:51

Yes, Racket (BC and CS) use the C library functions, currently.


plragde
2020-10-21 23:38:36

Ah, I forgot that floating-point coprocessors existed. Here is an Intel publication explaining the phenomenon. https://software.intel.com/content/dam/develop/external/us/en/documents/x87trigonometricinstructionsvsmathfunctions.pdf


plragde
2020-10-21 23:40:10

"…it would not be safe to use 𝐹𝑆𝐼𝑁(𝑥) to approximate sin(𝑥) for arguments 𝑥 near a nonzero multiple of π."


plragde
2020-10-21 23:41:57

The reason is basically what Matthew said.


anything
2020-10-21 23:45:03

If the libc (libm) is being used, then I would think the answer is system-dependent. Here’s an implementation written by IBM: https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=sysdeps/ieee754/dbl-64/s_sin.c;hb=HEAD


plragde
2020-10-21 23:54:22

That’s claiming results less than 1 ulp, which is in the ballpark of the errors quoted above.


badkins
2020-10-22 00:07:11

For what it’s worth, Julia returns the same value as Racket on my machine: julia> sin(pi) 1.2246467991473532e-16 Welcome to Racket v7.5. > (sin pi) 1.2246467991473532e-16


yfangzhe
2020-10-22 03:14:27

But my question is highlighting code in Slideshow, can this package be used in Slideshow?


kellysmith12.21
2020-10-22 04:33:03

Is anyone familiar with the paper, “Parsing with Derivatives”? I’m trying to understand how some parts of the functions involved work, but they’re a bit beyond my current knowledge.