IRC channel logs

2023-05-09.log

back to list of logs

<RhodiumToad>huh. the posix module wimps out on providing the sigset_t functions
<lloda>daviid: assoc assq assv are already in r5rs so
<lloda>i think having multiple versions might be even more confusing than the lack of consistency :-\
<RhodiumToad>I think the only real answer is pick the one you like best and stick with it
<flatwhatson>assq is like memq, assq-ref is like list-ref
<flatwhatson>in some sense it would be weirder to do otherwise
<lloda>true :-\
<apteryx>is there something in Guile to check if a string is an IPv4 or IPv6 value?
<RhodiumToad>how picky do you want to be?
<civodul>apteryx: you can use inet-pton as a heuristic
<civodul>see (gnu services base) as an example
<ArneBab>daviid: nowadays I prefer having both key alist and alist key: one is more useful for looking into an ad-hoc datastructure, the other for looking into a datastructure in a variable (assoc key (iota 5)) vs. (list-ref my-numbers (+ i 3)).
<ArneBab>And I wish tutorials would teach that :-)
<apteryx>civodul: OK, thanks!
<daviid>lloda: you wrote ' i wish this could be fixed somehow. Move the old functions to a module, make a new module with fixed defs' - so i wrote the module of your wish :) - i don't use those personally
<apteryx>what does ->bool do? it doesn't appear to be documented
<apteryx>and search engines are utterly useless
<apteryx>and where are things such as AF_INET6 defined? they seem to be unbound in my REPL
<apteryx>ah no, just AF_INET4 is
<apteryx>which is just called AF_INET
<civodul>yeah, these are the POSIX names
<civodul>->bool returns a Boolean from the given value
<civodul>(->bool #f) => #f
<civodul>(->bool 42) => #t
<apteryx>interesting; I'd have intuitively thought (boolean x) should have done that
<apteryx>should (ipv6-address? "2607:5300:60:6b0::c05f:543") return #t? it returns #f
<apteryx>ah, wait
<apteryx>I had a 'strip-port/maybe' pre-processing filter that is not safe with IPv6
<apteryx>it works
<RhodiumToad>the list of canonicalization rules for printing ipv6 addresses is surprisingly long
<RhodiumToad>ACTION tends to do his own input/output code for ip addresses, because of the sheer horrors perpetrated by inet_aton
<RhodiumToad>(but fortunately mostly not copied by inet_pton)
<apteryx>we do not have a guile-wireguard module yet, do we?
<gnucode>are there any "modern" projects that are written in prescheme?
<mirai>apteryx: I'm right now working exactly on that
<mirai>that = ipv6 question
<apteryx>mirai: in case it helps, this is the procedures I came up with: https://paste.debian.net/1279788/
<mirai>apteryx: are these endpoints always in IP:PORT form?
<mirai>here's my current iteration for the “extraction” part, it still needs to be rigged up to getaddrinfo <https://paste.centos.org/view/4baaf7cd>
<mirai>the port will need to be validated with a (<= 0 (string->number x) 65535) as well
<mirai>ideally these kinds of “useful” general purpose predicates would go into a (gnu services configuration utils) module for reusability
<apteryx>or in Guile ;-) I'm sure Python has those.
<apteryx>mirai: these are wireguard peer endpoints, they can be either host names or IPs (ipv4 or ipv6) and can have a :port suffix