IRC channel logs

2023-04-17.log

back to list of logs

<ArneBab>cow_2001: cyclic equal? is the only intrinsic failure of Guile on r7rs benchmarks (the other is just a regular timeout)
<cow_2001>hello arnebab
<ArneBab>Hi cow_2001 :-)
<cow_2001>what's an intrinsic failure? one where the current architecture of Guile makes it impossible to pass?
<cow_2001>i don't know what that test is
<cow_2001>i could look it up
<cow_2001>but i want to just adapt this queue into a deque as exercise 3.23 told me
<ArneBab>cow_2001: if you look at https://ecraven.github.io/r7rs-benchmarks/ only ctak and equal fail for Guile3. ctak is a normal timeout: given more time it succeeds. But equal fails because it has a cyclic list.
<ArneBab>cow_2001: I wrote a fun deque implementation for srfi-134: https://github.com/scheme-requests-for-implementation/srfi-134/blob/master/contrib/arne-babenhauserheide/deque.scm
<ArneBab>(actulally I wrote it for something else and then realized that only a little bit of extra work would make it implement srfi-134 :-) )
<cow_2001>nonononononono! i have to do it with this here tiny brain of mine
<cow_2001>only with mine own tiny brain
<ArneBab>sounds good
<cow_2001>(aka no spoilers)
<ArneBab>and then maybe steal the scaffolding that turns the deque into srfi-134? :-)
<ArneBab>(more than half of srfi-134 are just wrappers)
<ArneBab>Have fun!
<cow_2001>sorry!
<cow_2001>it's the sicp exercise
<dokma>ArneBab, cow_2001: lads, have you perchance used guile-websocket ??
<cow_2001>:|
<cow_2001>i am still just doing sicp
<cow_2001>manically
<ArneBab>dokma: yes. It needed a few hacks here and there, but it’s what drives https://dryads-wake.1w6.org
<ArneBab> https://hg.sr.ht/~arnebab/dryads-wake/browse/websocket.w?
<dokma>ArneBab: hmmm... that's different from this: https://git.dthompson.us/guile-websocket.git/tree/web/socket/client.scm
<dokma>Is any of those the "standard" one?
<dokma>Oh... I see at the top that the one you posted is an adaptation.
<dokma>ArneBab: I have no idea what I should pass to make-websocket by dthompson. "wss:ws.vi-server.org" doesn't work.
<ArneBab>dokma: yes, I hacked on it without any concern for generality
<dokma>I tried wss: ws: 443: https:
<ArneBab>I guess that uri is an uri: you’ll want something like make-uri
<dokma>Like (make-websocket (make-uri "wss:blah")) =
<dokma>(define (make-websocket uri-or-string)
<dokma> "Create and establish a new WebSocket connection for the remote
<dokma>resource described by URI-OR-STRING."
<dokma>Though it states that it accepts URI-OR-STRING
<ArneBab> https://hg.sr.ht/~arnebab/dryads-wake/browse/websocket.w?
<ArneBab>see File: guile.info, Node: URIs, Next: HTTP, Prev: Types and the Web, Up: Web
<ArneBab>dokma: https://www.gnu.org/software/guile/manual/html_node/URIs.html
<dokma>thank you
<ArneBab>The hint to that is in the imports: (web uri) ← that’s documented in the info manual. Approach to find it: open the info manual in emacs or with `info (Guile Reference)` and then use C-s uri- C-s to full-text-search it :-)
<dokma>I'm reading it already. But it seems to me that make-websocket should accept "wss:server"
<dokma>Am I wrong in that assumption?
<ArneBab>info 'Guile Reference'
<dokma>I am reading it already
<dokma>I tried wss://server as well but it does not work either
<ArneBab>I don’t know — my version is older and accepts a socket.
<ArneBab>It looks like it will accept (build-uri 'wss … )
<dokma>I used gdb to track the problem to the fact that when I pass wss:blah, C lib's getaddrinfo gets 0x0 for the server part ...
<dokma>Will try
<ArneBab>good luck! I wish we had more examples in the code …
<ArneBab> https://git.dthompson.us/guile-websocket.git/tree/test.scm
<ArneBab>It would be cool if you could write an example for the README and send it as patch to dthompson once you got it running!
<dthompson>dokma: the client and server work with unencrypted connections
<dthompson>you'd need to do some guile-gnutls integration to use encrypted connections
<dthompson>back when I wrote this I tested that I could use the guile websocket client or a web browser to talk to a guile websocket server.
<dokma>So no wss only ws?
<dthompson>right
<dokma>But this doesn't fly: (make-websocket (string->uri "ws://ws.vi-server.org"))
<dokma>
<dokma>ERROR: In procedure getaddrinfo:
<dokma>In procedure getaddrinfo: Servname not supported for ai_socktype
<dokma>
<dthompson>I recommend trying to connect to a local server first
<dthompson>looks like something unrelated to guile-websocket is going on there
<dthompson>I don't know what that error is
<dokma>clib's getaddrinfo receives NULL for the host part when I debug in gdb
<dthompson>or use guile's socket API to connect to that host directly and see if it worsk
<dthompson>works*
<dokma>Thanks
<dthompson>I haven't actually used this code in years. I wrote it before guile's web API had built-in support for TLS connections even.
<dokma>I see... maybe open-socket-for-uri is the better choice?
<dthompson>dokma: ooh yes! that did not exist when I wrote this code.
<dthompson>give that a shot. if you get something that works I would totally take a patch.
<ArneBab>dokma: for SSL I use nginx as ssl-terminator
<dthompson>ArneBab: that's good for the server side of things but dokma is using the client right now
<dokma>Yes, I am trying to connect to the Binance socket to access the exchange data.
<dthompson>oh is this some cryptocurrency thing?
<dokma>Yes.
<dokma>I want to do some trading algos in Scheme in order to allow me to write algos that would take the trading algos and attempt to improve them.
<dokma>From what I've learned, Scheme is basically ideal for these kinds of tasks.
<wklew>that's a big yikes
<wklew>literally watching the news as we speak about binance doing massive obvious fraud (no surprise)
<old>can't be worse than Celcius
<old>or maybe it can actually
<old>Celsius*
<wklew>maybe. that took a long time to fully unpack, i guess this will probably be similar.
<dokma>wklew: I don't trade there. I just take their data as they're one of the largest exchanges.
<wklew>seems like an incredibly bad and harmful idea to do any of it but whatever
<unmatched-paren> https://paste.sr.ht/~unmatched-paren/5e2f4102c31ea901b7814d5a856b5e7f1feec99f <- for some reason trying to use this macro throws a &non-continuable condition
<unmatched-paren>oh, hmm
<unmatched-paren>okay so it looks like the arms run but *then* it throws the error
<unmatched-paren>woooo i made it work :D
<unmatched-paren>i had to add #:unwind? #t to both WITH-EXCEPTION-HANDLERs
<unmatched-paren> https://paste.sr.ht/~unmatched-paren/0065724e08f5b31b2004afa8952396217a71dbe2
<old>unmatched-paren: I think you can't return a value in an exception handler without unwinding the stack
<old>you have to throw another exception
<unmatched-paren>old: that's good to know, thanks
<old>or restart the continuation if using call-with-abort-prompt
<RhodiumToad>(raise) raises an exception in a non-continuable context, so the exception handler can't just return
<old>If you want to have acccess to the stack frames, e.g. for printing a backtrace and returning a value
<old>you have to use two handlers. a pre-unwind and a post-unwind
<old>that's what `catch' does I think
<RhodiumToad>(raise-exception blah #t) raises a continuable exception, which means if the exception handler returns a value, it becomes the value returned by raise-exception
<RhodiumToad>er, might be (raise-exception blah #:continuable? #t)
<old>Right the continuation cna be restarted in that case from the handler if nothing is thrown
<unmatched-paren>ah, i think i'm starting to understand why #:unwind? exists now
<unmatched-paren>thanks :D
<unmatched-paren>how do i suppress this warning? "imported module (...) overrides core binding `&error'"
<unmatched-paren>my condition support module re-exports most things from SRFIs 34 and 35, which seems to be causing it to complain
<RhodiumToad>#:replace rather than #:export the symbol
<RhodiumToad>or #:re-export-and-replace for re-exports
<unmatched-paren>ah, #:re-export-and-replace, thanks :)
<RhodiumToad>btw, if you ever find yourself needing #:duplicates, be aware that there's a horrible bug
<RhodiumToad>specifically, it's processed too late, though there is a workaround by using (define-module) twice, first with just the #:duplicates clause, then with everything else
<RhodiumToad>this is especially an issue when using goops and merging of generics
<unmatched-paren>lovely :P
<RhodiumToad> https://github.com/RhodiumToad/guile-libarchive/blob/main/libarchive.scm <-- example