
Racket has a notion of procedures that return no values (using (values)
) but, for functions that are used for side effects only, the token value <void>
is returned instead. Is there a reason for that? (My guess is that (void)
predates procedures that return with no values.)

I’ve never seen anyone using (values)
seriously.

It’s not composable to the rest of the system. E.g., you can store it in a variable.

So (void)
makes much more sense to return

@ahmedgeo13 has joined the channel

There’s an extremely long discussion of this topic on the r6rs mailing list

I submitted a PR that caused the buildtest-macos job to time out after 6 hours, but I can’t replicate it locally. Is this something that happens intermittently or is this really something that my change did? https://github.com/racket/racket/runs/1597979328?check_suite_focus=true

After browsing the mailing list archives, I’ve noticed that I’ve been singlehandedly (and unwittingly) rehashing a few of the discussions from the R6RS development.

I also recommend the rrrs-authors list

Or maybe it’s rnrs-editors

Or something like that

I restarted it

That makes sense. Thanks. I’ll build this same example with scribble/lp2 and scribble/base. It won’t have the format I like, but then I’d be left with the task of making these adjustments, so the problem will be better-defined by then. Thanks so much!


I’m looking into scribble/lp2. When I @lp-include a literate program in a scribble file, I don’t see (out of the box) the file name of the program. So the scribble-generated PDF doesn’t indicate to the user in which file s/he would find that program. Looking at lp-include, there seems to be no option to such thing, so if I intend to, say, imitate noweb’s style, I would have to extend lp-include. I wonder if anyone has any [other] approach to this.


Using the regular site works for me

ah, I didn’t even notice the plt-racket domain

ah, apparently http://plt-racket.org\|plt-racket.org points to some machine at northeastern, probably the now-dead winooski

there’s a link to it in the guide, which I’ll fix up

oh thanks

This discussion from 1986 regarding multiple values is from before multiple values were standardized. (R3Rs is from dec 1986). https://groups.csail.mit.edu/mac/ftpdir/scheme-mail/HTML/rrrs-1986/msg00364.html

This was quite surprising. I moved the definition of a helper function a little higher in the enclosing function, and it increased the runtime by over 40% !! Even though it’s a small snippet, it may be a spoiler for Advent of Code Day 23. <https://gist.github.com/lojic/2aa8dd2acdbb5b32744220da65c6c1d1|Here is the code.> I moved line 5 above line 2. Results are identical, but significantly slower. I’m on Racket CS 7.9. I’m just curious what optimizations are going on to account for this.

Auto unboxing of v1
, v2
and v3
?

Internal definitions expand differently when there are forward references — to a letrec
instead of let*
in this case. And then a later pass (BC optimizer or schemify in CS) doesn’t work out that the letrec
can be reordered to something like a let*
.

Schemify certainly could be made smarter here. It doesn’t really try with letrec
s that have a mixture of functions and non-functions.

Thanks for the explanation.

It’s not the first time I’ve been bitten by define
. I know it’s the Racket way to prefer define
vs. rightward drift, but it seems easier to reason about let
, so I just changed it to: (define (get-destination obj three max-n vec)
(let* ([ v1 (q:node-val three) ]
[ v2 (q:node-val (q:node-next three)) ]
[ v3 (q:node-val (q:node-next (q:node-next three))) ]
[ in-removed? (λ (label) (or (eqv? label v1) (eqv? label v2) (eqv? label v3))) ]
[ high (let loop ([ n max-n ]) (if (in-removed? n) (loop (sub1 n)) n)) ]
[ low (let loop ([ n 1 ]) (if (in-removed? n) (loop (add1 n)) n)) ])
(let loop ([ label (sub1 (q:node-val obj)) ])
(cond [ (< label low) (loop high) ]
[ (not (in-removed? label)) (vector-ref vec label) ]
[ else (loop (sub1 label)) ]))))

Could i write an extension to read that lets me do string interpolation like with python’s fstrings?

So that i could do something like #f"{1} {(* 2 3)}"
to transform to (format "~a ~a" 1 (* 2 3))
(or something else of equivalent functionality)


and here’s how you can use it: https://github.com/sorawee/aoc/blob/7339f0f1e63f8b3f1c43582be0bc34012c014d4c/2019/day01/task.rkt#L39

Whenever the lexer sees $
, it switches to a new mode that tries to find a matching """
and """
. Stuff between $
and """
is a transformation function.

okay, thanks!

Here’s the definition of ~nl
, for example: https://github.com/sorawee/aoc/blob/7339f0f1e63f8b3f1c43582be0bc34012c014d4c/lang/aoc.rkt#L87

okay

so in my system i would have to do $f"5 * 3: {(* 5 3)}"
instead, but it’s the same idea

You can make it recognize f"..."
directly, but I think it will be more annoying since you also want to be able to create an identifier starting with f
.

oh yeah

i was hoping to do #f"..."
just because that’s the way the rest of racket’s literals are, but i guess that makes sense how you can do whatever you want

that would probably also cause issues if i wanted to use #f
:slightly_smiling_face:

You can use #f
for the format strings, as long as you don’t mind writing out #false
every time.

i think i will just pick a different letter

actually I recently switched to writing out #true
and #false
explicitly and now vastly prefer it

I also like #true
and #false
; it’s surprisingly easy to mix up #t
and #f
when reading code.

I didn’t know that #true and #false were opions. I will definitely be switching to them

@me1890 Instead of a single letter, you could also use #fmt
for format string, similar to how regular expressions use #rx
.

yeah, that’s probably a good idea

always better to be clear

In the teaching languages, they always made us use true
and false
(without the #
)

idk why that was necessary, might as well have made use the actual #true
and #false