IRC channel logs
2023-03-12.log
back to list of logs
<cow_2001>(cut fold-right op <> <>) is equivalent to (cut fold-left op <> <>) iff op is associative, right? <mirai>what does "Terminate the current process without unwinding the Scheme stack." mean / i.e. when to prefer primitive-exit over exit ? <jpoiret>mirai: unwinding the scheme stack would mean that dynamic-wind out guards would be run, whereas if you don't unwind they wouldn't <jpoiret>primitive-exit is for when something broke and the dynamic-wind guards can't even be trusted to run properly <mirai>how can I configure a "timeout" for (web client) http-... procedures? <lechner>Hi, an earlier 'define' cannot see a later 'define' even at the root level, right? Is that due to lexical scoping? <mwette>lechner: not really true; (define x (lambda () y)) (define y 1) (x) <jpoiret>lechner: that's just due to how the language works, it has nothing to do with lexical scoping <jpoiret>guile reads each declaration one after the other, and if one of the declaration errors out, then that's it <lechner>jpoiret / okay, thanks. should i rearrange, or leave it for someone else? <jpoiret>ah, I didn't read the rest! that's a guix error, not a generic guile one <jpoiret>inputs in guix are thunked, which means they're actually lambdas with no arguments and are evaluated afterwards, this corresponds exactly to what mwette wrote above <lechner>jpoiret / unfortunately, his message does not make the guix error go away <rekado>civodul: should I have expected that current-filename doesn’t work when using load? <lechner>i also have problems with define-configuration in load <civodul>rekado: hi! no, definitely not; i'm not sure why it doesn't work <civodul>source location is passed from read or read-syntax to psyntax and macros (current-filename is a macro) <rekado>civodul: okay, I thought I overlooked something <rekado>I’ll try to come up with a smaller reproducer <mirai>is there some way to "wrap" the http-head procedure to avoid a potential lockup if the request never times out? <lechner>Hi, I can slurp with (call-with-input-file name get-string-all) what's a good way to do the opposite, i.e. "spew" a string? (call-with-output-file name (lambda (port) (put-string port string))) does not seem to work <old>mirai: You need an event loop for that. fibers might be of help here <mwette>lechner: did you look at force-output? <old>mirai: you're talking about the client side? In that case you might be able to simply use a global timer in between request? <mirai>I simply want to issue a http-head (or get, doesn't matter) to a url to check that it's up (a heartbeat of sorts) <old>okay I can hack something for you <mwette>lechner: maybe something else, like is name created in a writable dir? <lechner>the error scrolled off because it prints the file contents in my window <old>Should work if you're not using SIGALRM <old>it won't work if your application is multi-threading since `setitimer' is global <lechner>mwette / flatwhatson / i am writing the script. repl is above my paygrade <flatwhatson>lechner: eg. this works: (call-with-output-file "test.txt" (lambda (port) (put-string port "hello world"))) <lechner>but the moment i put this other longer string, it bombs <flatwhatson>"scrolled off"? maybe just capture the output into a file so you can debug it? <old>mirai: however if you control the entire application, the `make-timeout-wrapper' could be optimized by removing the unecessary sigaction stuffs, saving a few syscalls <lechner>flatwhatson / that's exactly what i was trying to do <lechner>mwette / flatwhatson / thanks for your help. now i just write to stdout from the script <old>mirai: but for a heartbeat, you probably do not want to pass through a http protocol, but instead stay at the networking level by using ICMP instead of TCP <old>well it depends on your use case I guess <rekado>mirai: Guix has open-socket-for-uri (and http-fetch using it) in (guix build download). <rekado>open-socket-for-uri accepts an optional timeout argument <rekado>this is something I’d like to see in Guile itself. The implementation of open-socket-for-uri is quite complicated and verbose.