notjack
2021-6-24 08:07:27

Is it possible to make a splicing-cond, where it’s like cond except definitions inside each branch are treated like they’re in the same definition context as the surrounding code? so for example, this code should raise an error saying that a is already bound: (define a 1) (splicing-cond [foo (define a 2) (+ a 1)] [else (void)])) just like it would raise an error in this code: (define a 1) (define a 2) (+ a 1)


sorawee
2021-6-24 09:54:52

What should happen in

(splicing-cond [a (define x 1) 1] [else (define x 1) 2]) ?


notjack
2021-6-24 10:00:23

in my particular case, splicing-cond would only ever appear in tail position so what I’d like is for separate branches to not interact with each other but for branches to interact with the code before the splicing cond


ben.knoble
2021-6-24 10:41:58

Wonderful, I’ll give that a try. Just when I thought I was groking syntax-parse, I learned a few new tricks :)


jagen315
2021-6-24 12:31:08

@notjack so I was trying to define lenses on a struct I had contract-outed, and racket was telling me the usual identifiers were unbound. then I found, through macro stepper investigation, that this works:

(define-struct-lenses foo) provide/contract-id-foo-bar-lens I ended up defining the lenses in the same file, before contract export, but I am curious if there’s any way to make this work correctly!


gknauth
2021-6-24 18:00:02

When I programmed in Smalltalk, I would right-click on identifiers to see everything available. I could never remember it all.


soegaard2
2021-6-24 20:45:38

Anyone knows more about the “incremental garbage collection mode”? https://news.ycombinator.com/item?id=27621014#27623198


soegaard2
2021-6-24 20:45:58

(search for soegaard on the page)


mflatt
2021-6-24 21:08:42

Meeting 16ms deadlines is within reach with Racket and incremental GC mode. Even 1–2ms is sometimes with reach, as long as the the screen is not involved.

On Mac OS, a screen-refresh sync can sometimes creates 16ms pauses, which is at the root of the problem that Matthijs de Jonge reported at Racketfest for music synthesis.

Overall, though, it’s complicated, and real-time behavior depends on a lot of things (both code and environment) that can push a goal into reach of out of reach.


hazel
2021-6-24 21:19:48

is there an existing library for displaying 2D tables of values on the command-line? want to make sure I’m not reinventing the wheel




alexharsanyi
2021-6-24 22:53:00

Actually, for GPU based rendering, an application only needs to meet the <http://16.ms|16 ms> deadline on average — most graphics cards use three buffers behind the scenes to smooth out small inconsistencies between frames. Also, for 30FPS games, you only need to meet a 32ms deadline…

I think Racket would do fine for writing games with GPU rendering. But it is not trivial to write a rendering engine — I know this because I wrote one for my job (not in Racket though…)


notjack
2021-6-25 01:05:45

huh, that’s pretty weird


notjack
2021-6-25 01:07:50

I usually define lenses in the same file as the struct in question, and lately I’ve shifted towards preferring struct-guard/c instead of adding contracts to structs with contract-out


notjack
2021-6-25 01:08:23

both of those approaches sidestep the problem


jbclements
2021-6-25 03:29:01

I’m baffled by the behavior of the package server when trying to add a new package. I filled out the form early this afternoon, and clicking “save” apparently just reset all the fields to blank; no idea if the package was added. Now, about 10 hours later, I reload the pkg page… package not there. So I sigh and enter the info again, and click “save”, and get the message “Save Failed.” Huh? So I try clicking the “save” button again, and this time it’s back to the original behavior: all fields blank, apparent… success? or failure? No way to know. Is this a known problem with the package server?


jbclements
2021-6-25 03:52:04

+1 for text-table, I use it all the time.