IRC channel logs

2023-03-27.log

back to list of logs

<lloda>the fact that lists are made up of pairs is a big millstone on Scheme's neck. It would be better if they were an abstract type
<cow_2001> https://git.sr.ht/~kakafarm/sicp/tree/master/item/solutions/huffman-codes-stuff.scm#L124 and https://git.sr.ht/~kakafarm/sicp/tree/master/item/solutions/tests/exercise-2.69-tests.scm
<cow_2001>is this the right solution?
<haugh>lloda, we have vlists
<dsmith>sneek, botanack
<dsmith>sneek, botsnack
<sneek>:)
<_graywolf>How can I do http request with custom header using (web client)? I'm trying #:headers '((content-type . "foobar")) however it dies with Bad value for header content-type. Anyone got an example?
<singpolyma>Did you try foo/bar ?
<_graywolf>Bad request: Bad value for header content-type: "foo/bar"
<_graywolf> #:headers '((content-type . "foo/bar"))
<_graywolf>I feel like I must just be holding it wrong :/
<haugh>I haven't looked at this in a minute but aren't headers their own type? Like they convert back and forth to/from strings. Maybe http-request is supposed to do that conversion though
<_graywolf>For me it's first time trying to do http request in guile, so I just tried to follow the documention and got stuck
<_graywolf>Hm, if I change the content-type to bazbar, it starts to work. So it looks like some headers have special, non-documented behavior. :/
<rekado>_graywolf: you need to use symbols
<rekado>_graywolf: e.g. '((content-type . (application/json)))
<_graywolf>rekado: That does it, thank you very much! :)
<flatwhatson>if anyone is interested in hacking the OpenAI API with guile, i've whipped something up: https://gitlab.com/flatwhatson/guile-openai
<_graywolf>How do I convert string to a "character generator"?
<haugh>_graywolf, do you want a port?
<haugh>(call-with-input-string "foo" read-char) ⇒ #\f
<_graywolf>Ah, port would work as well for me, thanks :) I'm actually not sure what srfi-180 means by "character generator" exactly, but port is accepted as well, so I'll use that.
<_graywolf>Thanks
<haugh>if you're doing what I think you're doing, you might want to have a look at aconchillo/guile-json
<haugh>doesn't support streaming, though
<_graywolf>I don't think I need streaming (the jsons are small), my pick was based on "hey, there is a standard thing, so let's use it"
<haugh>there's nothing wrong with srfi-180 but Aleix's declarative approach is very convenient. With some caveats, of course :)
<_graywolf>Oh, I'm looking at the readme and the conversions between records and jsons looks definitely handy
<_graywolf>Seems like it will simplify handling a lot for my use case
<haugh>flatwhatson, nice use of streams
<mwette>_graywolf: my immediate reaction is string-unfold
<unmatched-paren>is there a REPL command equivalent to ADD-TO-LOAD-PATH?
<unmatched-paren>can't find anything in the manual
<unmatched-paren>it's not exactly a massive issue, but it would be nice to write ,add-load-path src rather than (add-to-load-path (string-append (getcwd) "/src")) when I start the repl
<unmatched-paren>i love how guile always seems to have a convenient construct that cuts out ugliness... i was about to begrudgingly write (let (...) (and symbol (let (...) ...))) before i realised that AND-LET* exists :)
<stis>Howdy guilers!
<unmatched-paren>stis: hello!
<stis>What's up in guile land?
<unmatched-paren>stis: do you know if there's a REPL equivalent to ADD-TO-LOAD-PATH, by any chance? I can't find anything in the manual
<stis>can you eplain more, isn't that available?
<stis>.guile is read for the reple now and there I use it
<stis>hmm
<stis>lemme try
<unmatched-paren>ADD-TO-LOAD-PATH works in the REPL, but it's not very convenient to use relative to the CWD
<unmatched-paren>(add-to-load-path (string-append (getcwd) "/src")) is not very nice to type every time you open up a project to edit
<stis>add such a function to the .guile ?
<stis>(define (myadd str) (add-to-load-path (string-append (getcwd) str)))
<mwette>you can define your own REPL commands. https://paste.debian.net/1275438/ then start guile and type ,help extra
<mwette>the above could go in your .guile
<unmatched-paren>mwette, stis: yes, i think i'll define ,module-path in my .guile, thanks :)
<ArneBab>daviid: thank you (re list)