IRC channel logs

2025-01-03.log

back to list of logs

<cow_2001>(cond ((library (srfi 0)) 'a)) => error! instead of the symbol a
<cow_2001>what is going on?
<cow_2001>err
<cow_2001>cond-expand, sorry
<cow_2001>does guile support the (cond-expand ((library (some library path)) 'a)) where (some library path) is a library you can import and the whole cond-expand value would be a 'a
<cow_2001>?
<cow_2001>trying to make srfi-123 work where it is used
<cow_2001>i have a fix to an example in the manual for srfi-31, but i cannot currently post a git format-patch file. it is here: https://codeberg.org/kakafarm/guile/src/branch/fix-srfi-31-example
<cow_2001>the diff: https://codeberg.org/kakafarm/guile/compare/master...fix-srfi-31-example
<cow_2001>oh, and hash: a9cb6dd0156ebbd9ff2448dba05207e885b57608
<cow_2001>i have a feeling i could have just written a compressed base64 message of the format-patch file and it would have been shorter than the above few messages
<cow_2001>also working on https://codeberg.org/kakafarm/guile-srfi-123
<cow_2001>maybe will write a package definition for guix tomorrow
<dariqq>hi, are there examples somewhere for how to catch exceptions with libguile?
<dariqq>i think i figured it out
<rlb>dariqq: presume you found it, but in case not: https://www.gnu.org/software/guile/manual/html_node/Exceptions.html
<dariqq>rlb: thanks, I had some problems how to use scm_c_catch especially how to handle things when the function takes more than one argument but found some examples through searching which helped
<rlb>Ahh, ok.
<dsmith>dariqq, It's kind of complicated, but here is an example of handling Scheme -> C -> Scheme -> raise https://gitlab.com/dalepsmith/guile-sqlite/-/blob/master/sqlite.c?ref_type=heads#L141
<dsmith>(That's the code the bot has been using for about the last 20 years or so)
<sneek>ACTION waves
<dsmith>sneek, version
<sneek>Sneeky bot running on Guile version 3.0.3 using bobot++ release.2.3.1-6-a463-dirty
<dariqq>dsmith: Thanks, currently i am just doing the equivalent of false-if-exception for things like scm_call_x which is a lot more involved than I thought. I guess the macro hides a lot of the complexity away when not using C
<lechner>Hi, can this 'car' on top of 'assq-ref' be written more concisely? (let* ((maybe (assq-ref alist key))) (if maybe (car maybe) #f))
<dthompson>(and=> (assq-ref alist key) car)
<dthompson>I think... not tested :)
<lechner>dthompson / thanks, it works!
<dthompson>yay sometimes the ol' brain gets it right on the first try
<mwette>and=> is one of the gems
<dsmith>yey!
<Arsen>oh wow, that's neat
<lechner>Hi, does anyone have an example for a macro that takes an ellipsis of lists, i.e something like (manufacturer . name) ... to be used with something like (gold-delicious "Golden Delicious Apple") (banana "Cavendish banana") I'm not sure how to access the key and datum separately
<dsmith>"(manuf name) ..." and then "manuf ..." and "name ..."
<lechner>wow, that works?
<dsmith>Probably not what you meant/wanted.
<lechner>can I also use "(manuf name) ..." in one place?
<lechner>in the template
<dsmith>If in your template you can have zero or more of that, yeah
<dsmith>The classic case is a let with `(binding value) ...` transformed into a lambda with the `(binding ...)` and applying it to the `value ...`
<lechner>dsmith / wow, that just solved one of my big feature ideas!
<lechner>dsmith / thank you so much!
<dsmith>Sure! np
<mwette>more examples: https://www.scheme.com/tspl4/syntax.html#./syntax:h4
<dsmith>mwette, Hah! I was just looking for that!
<dsmith>Often the ,,, is used recursively, so with `e1 e* ...` you handle `e1` and then recursively call the macro with `e* ...`
<lechner>Discovering Guile changed my world. What a great language!
<lechner>Plus, I do whacky things with foreign libraries but somehow it all works
<lechner>no more Perl for me
<dsmith>Oi!
<dsmith>ACTION shudders