
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:

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

are you looking for keyword highlighting/coloring?

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

Yes

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.

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

:disappointed: Thanks for your answer

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

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.

[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.

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

was this recorded?

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!)

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

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.

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

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

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 has joined the channel

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

great idea re: #lang for pygments

I am getting the error below from Pasterack.

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))))

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

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.

You can send issues here: https://github.com/stchang/pasterack/issues

It seems like pasterack could use some help though

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?

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?

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

Opening an issue would be best - thanks!

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

Thanks @mflatt! That certainly is easy!

@spdegabrielle That was asked a month ago :slightly_smiling_face:

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)


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

@francois.scheepers has joined the channel

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

Isn’t this what people want?

@malik.redwood has joined the channel

@nina has joined the channel

@ann-bolotina has joined the channel

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)

Welcome to the wonderful world of floating-point computation

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

There is a certain degree of approximation going on.

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?

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

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

My guess — they use hardware instructions!

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

(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.)

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

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

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

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

The reason is basically what Matthew said.

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

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

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

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

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.