IRC channel logs

2021-12-07.log

back to list of logs

<gbrlwck>i have code like this: https://termbin.com/6mt4 and get a warning that a datum 'foo cannot be meaningfully compared using `eqv?'. i checked in guile repl and comparisons from symbol to symbol seemed to work fine. is there a (case) that uses other comparisons?
<robin>gbrlwck, the first elements of case clauses don't need to be quoted; it should be simply (case event ((page-up) ...) ...), assuming event is a symbol
<gbrlwck>thanks!
<robin>(with the extraneous quote, guile compares event to both quote and (page-up), the latter of which is causing the warning)
<robin>np
***karlosz_ is now known as karlosz
<lilyp>fnstudio: apart from let-values, you can also (match lst ((a b c . rest) ...))
<RhodiumToad>I actually mentioned that first :-)
<fnstudio>lilyp: oh thanks, yes that was also mentioned but thanks for reminding and providing an example - appreciated!
<fnstudio>there's this simple data structure that i think i can implement with a hash-table or a vector (i.e. a monodimensional array)
<fnstudio>i wouldn't have any reason to use a hash-table if not the fact that my function receives the data as an hash table as input
<fnstudio>(e.g. i don't need to grow the data structure by adding new elements to it, therefore a vector would be fine)
<fnstudio>is there any strong rationale for moving the data back from the hash table and into a vector?
<RhodiumToad>fetching it from the vector might be faster?
<fnstudio>yeah, that's what i wanted to ask...
<fnstudio>RhodiumToad: thanks
<RhodiumToad>hash table lookups have to compute the hash, fetch the vector slot based on that, then traverse a list comparing the keys
<fnstudio>hm yes, i had some vague feeling that all the machinery surrounding HTs might come to some cost tradeoff
<fnstudio>but it was just a vague feeling, no idea of the internals
<RhodiumToad>well usually you are using it because the key isn't something that maps to a vector index easily
<fnstudio>ok, cool, i'll go for a vector then
<fnstudio>super thanks
<fnstudio>RhodiumToad: yes, sure, i can totally see the reason for HTs, but happy to go for a vector in this particular case
<fnstudio>i need to quote a variable in a doc string, e.g. `a-string`
<fnstudio>i guess there's no strongly established convention on the markup to use?
<fnstudio>e.g. backticks vs single quotes? `` vs '' vs org mode style =a-string= vs ...
<RhodiumToad>what's the context?
<fnstudio>a docstring
<fnstudio>for a guile procedure
<RhodiumToad>no, I mean the text around the mention of the variable in the docstring
<fnstudio>oh sorry :) right, something along the lines of "Get the groups of =max-size= cardinality."
<lampilelo>if you're mentioning an input parameter for a function you're documenting you typically use all caps for it
<lampilelo>and it seems like mentioning anything else is done with `thing'
<lampilelo>it gets translated to ‘thing’
<fnstudio>lampilelo: oh right backtick+single quote, makes sense, thanks
*RhodiumToad hates those `blah' quotes with the white-hot heat of a thousand giant suns
<fnstudio>RhodiumToad: yeah, i think i share some of that sun light
<fnstudio>lampilelo: with regard to the uppercase input parameter, i think i'll have to look for an example
<fnstudio>but i guess i can find it in the guile repo, don't worry
<fnstudio>thanks for mentioning that case
<lampilelo>RhodiumToad: i don't really mind `', why do you hate it so much? ocd because they don't match visually?
<RhodiumToad>they don't match either visually or semantically
<lampilelo>yeah, but what can you do, there are no ‘’ keys on most keyboards and these symbols aren't ascii
<RhodiumToad>back in the day that was a reasonable excuse, though I think using 'blah' would have been better
<RhodiumToad>but now, ‘ and ’ are pretty easily accessible
<lampilelo>hm, i think i agree
<RhodiumToad>guile even accepts (λ args body) these days
<lampilelo>would texinfo format everything correctly if ‘ and ’ were to be used directly?
<RhodiumToad>dunno, never tried
<lloda>texinfo seems to handle ‘’ fine, at least 6.8 does
<lloda>i don't know if you can require unicode tho
<attila_lendvai>let-values doesn't ignore/tolerate more values than listed, and then prints "Wrong number of values returned to continuation (expected 3)". *slowly shakes head*
<lloda>you can use (let-values (((a b . ignore) (produces 2 o or more))) ...)
<taylan>I think not tolerating more values than specified is a good thing, so long as there's a simple way to ignore them explicitly (like lloda demonstrated). having them ignored could mask a bug that blows up later.
<taylan>I even think that any values returned to zero-value continuations (non-tail positions in bodies) should be an error. and using 'if' on something that isn't a Boolean. :P
<taylan>the former might be overkill (e.g. "(begin 1 2)" would be an error, then again it *kinda* makes sense?) but it can also catch bugs ("return value of procedure call was not handled!")
<lloda>i agree with all of that
<lloda>well i don't agree with if requiring boolean. Having a single false value in Scheme means (if anything ...) doesn't cause problems. Requiring boolean would just mean having to write (if (true? ...) ...) everywhere
<ArneBab>taylan: I like it that in Scheme everything that’s not #f is true. That avoids many errors I’ve seen in production. And you don’t want to debug "0 is falsy" because someone passed a legal value to if (value) …
<RhodiumToad>except in guile, #nil is also false :-)
<pinoaffe>but '() is true :$
<RhodiumToad>well #nil is only there for elisp emulation purposes
<pinoaffe>I know
<lampilelo>scheme is not cl, why shouldn't '() be not false?
<RhodiumToad>why not indeed
<spk121>does anyone know what the config.guess response is for MacOS?
<RhodiumToad>*-apple-darwin, probably
<RhodiumToad>*-apple-darwin* since it'll have the release
<spk121>thanks