kellysmith12.21
2020-12-23 11:00:03

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


sorawee
2020-12-23 11:05:36

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


sorawee
2020-12-23 11:06:00

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


sorawee
2020-12-23 11:06:11

So (void) makes much more sense to return


ahmedgeo13
2020-12-23 12:09:38

@ahmedgeo13 has joined the channel


samth
2020-12-23 12:39:12

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


dvanhorn
2020-12-23 14:22:49

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


kellysmith12.21
2020-12-23 14:56:53

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.


samth
2020-12-23 14:58:56

I also recommend the rrrs-authors list


samth
2020-12-23 14:59:07

Or maybe it’s rnrs-editors


samth
2020-12-23 14:59:10

Or something like that


samth
2020-12-23 15:00:16

I restarted it


anything
2020-12-23 15:21:30

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!


dvanhorn
2020-12-23 16:49:04

anything
2020-12-23 17:39:04

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.


samth
2020-12-23 17:42:44

samth
2020-12-23 17:43:00

Using the regular site works for me


dvanhorn
2020-12-23 18:46:05

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


samth
2020-12-23 18:47:05

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


dvanhorn
2020-12-23 18:48:04

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


samth
2020-12-23 18:48:11

oh thanks


soegaard2
2020-12-23 19:17:25

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


badkins
2020-12-23 21:38:51

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.


badkins
2020-12-23 21:40:17

Auto unboxing of v1, v2 and v3 ?


mflatt
2020-12-23 23:30:37

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


mflatt
2020-12-23 23:31:08

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


badkins
2020-12-24 00:06:22

Thanks for the explanation.


badkins
2020-12-24 00:23:11

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 [ (&lt; label low) (loop high) ] [ (not (in-removed? label)) (vector-ref vec label) ] [ else (loop (sub1 label)) ]))))


me1890
2020-12-24 04:37:22

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


me1890
2020-12-24 04:38:42

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)




sorawee
2020-12-24 04:43:36

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


me1890
2020-12-24 04:43:54

okay, thanks!


sorawee
2020-12-24 04:44:21

me1890
2020-12-24 04:45:14

okay


me1890
2020-12-24 04:46:04

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


sorawee
2020-12-24 04:47:07

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.


me1890
2020-12-24 04:47:39

oh yeah


me1890
2020-12-24 04:48:22

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


me1890
2020-12-24 04:48:55

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


kellysmith12.21
2020-12-24 05:03:27

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


me1890
2020-12-24 05:25:45

i think i will just pick a different letter


notjack
2020-12-24 05:31:20

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


kellysmith12.21
2020-12-24 05:52:51

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


me1890
2020-12-24 05:54:15

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


kellysmith12.21
2020-12-24 05:54:28

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


me1890
2020-12-24 05:54:43

yeah, that’s probably a good idea


me1890
2020-12-24 05:54:53

always better to be clear


phanthero
2020-12-24 07:32:18

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


phanthero
2020-12-24 07:32:42

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