sagax has quit [Remote host closed the connection]
orivej has joined #racket
caltelt has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 265 seconds]
C79 has joined #racket
C79 has left #racket [#racket]
kritixilithos has joined #racket
orivej has joined #racket
narimiran has joined #racket
kritixilithos has quit [Ping timeout: 240 seconds]
kritixilithos has joined #racket
fridim has quit [Ping timeout: 252 seconds]
fridim has joined #racket
panico has quit [Remote host closed the connection]
YuGiOhJCJ has joined #racket
orivej has quit [Ping timeout: 240 seconds]
iyzsong has joined #racket
vraid has joined #racket
Fernando-Basso has joined #racket
orivej has joined #racket
ZombieChicken has quit [Quit: WeeChat 2.7.1]
orivej has quit [Ping timeout: 240 seconds]
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #racket
orivej has joined #racket
sagax has joined #racket
orivej has quit [Ping timeout: 240 seconds]
ZombieChicken has joined #racket
narimiran has quit [Ping timeout: 240 seconds]
iyzsong has quit [Ping timeout: 240 seconds]
alinsoar has joined #racket
alinsoar has quit [Remote host closed the connection]
ArthurStrong has joined #racket
alinsoar has joined #racket
<alinsoar>
Hi, I try to define a macro using define-syntax and syntax-case and I do not know how to print the expanded code, after the syntax expansion finishes.
kritixilithos has quit [Ping timeout: 240 seconds]
alinsoar has quit [Remote host closed the connection]
alinsoar has joined #racket
nullcone has quit [Quit: Connection closed for inactivity]
kritixilithos has joined #racket
kritixilithos has quit [Ping timeout: 240 seconds]
<greghendershott>
alinsoar: Recommend using Macro Stepper in Dr Racket or similar feature in Racket Mode.
<greghendershott>
The "hiding" feature will help you focus on your macro, not fully-expanded Racket forms which can feel overwhelming like "assembly language"
<greghendershott>
Or you can do something like (syntax->datum (expand some-example-use-of-your-macro))
kritixilithos has joined #racket
<greghendershott>
In simple cases if you macro "foo" is defined in same namespace, (syntax->datum (expand #'(foo blah blah))).
<greghendershott>
Oh also there's command-line `raco macro-stepper`
<greghendershott>
As a quick way to launch just the stepper GUI
<alinsoar>
greghendershott thanks
kritixilithos has quit [Ping timeout: 240 seconds]
<alinsoar>
greghendershott in expansion I got (#%app (#%top . k) ; what is the meaning of #%app and top ?
<greghendershott>
It sounds like you're trying to use `expand` in a namespace that doesn't have racket/base in it, which defines those, you can find in Racket docs
kritixilithos has joined #racket
<greghendershott>
Suggest using macro stepper if you just want to see your macro expansion without getting into a whole detour right now :)
<alinsoar>
greghendershott thank you!
<greghendershott>
(but `#%app` is hook that lets you redefine function application, and, `#%top` you're less likely to use but can read about in docs)
<alinsoar>
I expected to get (lambda (k) ((lambda (k) (k 100)) (lambda (ev) (k (set! v ev)))))and in fact I got '(#%expression (lambda (k) (#%app k (#%app set (#%top . b) '100))))
<alinsoar>
I am not sure it is correct what I did
ArthurStrong has quit [Quit: leaving]
<alinsoar>
macro use in racket is infernal
<alinsoar>
Can I find a working example of define-syntax combined with syntax-case and to be recursive ?
<alinsoar>
I want to define a recursive macro with define-syntax combined with syntax-case
<greghendershott>
alinsoar: That's what I meant about _fully_ expanded syntax being a little overwhelming and feeling like "assembly language".
<greghendershott>
The stepper tools will hide expansion down into those very primitive forms, if you want, letting you focus on your own stuff
<lavaflow>
I don't really want to reinvent the wheel if I don't have to, but I don't see anything in the docs for it already
<lavaflow>
basically I'm thinking for each place, I create a new logger with a log receiver that sends log events across a place channel
<lavaflow>
changing the log level during runtime would require me sending some sort of control message back to each place I think, to avoid sending log events across the place channel that will be ignored anyway
zenspider has joined #racket
sz0 has joined #racket
<greghendershott>
lavaflow: I haven't, not really. Closest I've come is making a log-receiver that HTTP PUTs things to a "cloud" logging service.
<greghendershott>
I think you're right about needing to send a control message to places, to set the log level, so they behave more efficiently even short of sending things.
<greghendershott>
As for sending log events, I think you could look at that orthogonally? e.g. Not even use places, for that, necessarily?
dustyweb has quit [Remote host closed the connection]
<greghendershott>
If you know you'll want one central log event store, whether it's your own or third party, that could work however you prefer. Which might be using place channels, or not.
<lavaflow>
I thought about having each place just write to the log file itself, but it seems those writes aren't necessarily atomic, particularly if they're not small
<greghendershott>
Hmm OK so it can't be quite _that_ simple, maybe. :)
<greghendershott>
There is support to use the OS system logger, I think?
<lavaflow>
I'm not sure, that's probably worth considering though
<lavaflow>
I didn't see anything in the docs about syslog, but I didn't look very hard
<lavaflow>
each place sending log messages to syslog instead of across a place channel seems reasonable enough
<greghendershott>
I think it might even be on by default, for some OS's, but only for error level?
<lavaflow>
looks like you're probably right: "For this initial logger, two log receivers are also created: one that writes events to the process’s original error output port, and one that writes events to the system log."
<lavaflow>
I'm not using the initial logger because I don't want it outputting to stderr, so I guess I dropped the system log receiver at the same time inadvertently
<lavaflow>
(spamming stderr seemed to cause trouble for emacs and/or geiser, I'm not really sure why.)
<greghendershott>
Logging, for me, is either of two extremes. Either I'm "OMG just-work I don't want to think about it", -or-, a complete yak shave detour. But never a happy medium. :)
<lavaflow>
yeah pretty much :D
<greghendershott>
So if my suggestions sound lazy, it's from trying to tip into the latter. :) Sorry to project onto you.
<lavaflow>
not at all
<lavaflow>
my logging breaks after dynamic-rerequiring one of my modules (the dozen or so before it don't break anything)
<lavaflow>
the module that breaks it happens to be the one that uses racket/unsafe/ops... this could be fun
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
<lavaflow>
nothing to do with unsafe ops apparently, it just stops after the last one no matter what it is. huh.
<notnotdan>
https://docs.racket-lang.org/guide/performance.html#%28part._.Mutation_and_.Performance%29 Why does it say here that "a new location is allocated for x on every iteration"? I would imagine that the same location `n` is used for every iteration
efm has quit [Remote host closed the connection]
efm has joined #racket
nullcone has quit [Quit: Connection closed for inactivity]
narimiran has quit [Ping timeout: 260 seconds]
Fernando-Basso has quit [Quit: Leaving]
sz0 has quit [Quit: Connection closed for inactivity]
efm has quit [Ping timeout: 240 seconds]
efm has joined #racket
vraid has quit [Disconnected by services]
vraid has joined #racket
orivej has joined #racket
<lavaflow>
I don't know what the problem was, but it was seemingly something to do with with-logging-to-port and/or how I was using that
<lavaflow>
I replace the use of with-logging-to-port with a thread looping on (fprintf log-file "~a~n" (sync log-receiver)) and now things seem to work. tbh this seems a suitable enough solution to me.