IRC channel logs

2023-09-17.log

back to list of logs

<mwette>.
<sarthalion>Hi! What I'm doing wrong as ld cannot find guile (I have installed guile-devel (on Fedora)
<sarthalion>CFLAGS += -std=c99 -Wall -lguile -lgmp -lm
<sarthalion>/usr/bin/ld: cannot find -lguile: No such file or directory
<Arsen>sarthalion: try: pkg-config --libs guile-3.0
<RhodiumToad>libguile isn't named libguile, it'll be -lguile-3.0 or whatever
<RhodiumToad>hence pkg-config
<minima>hi, is there any best practice around "serialising" a record to a list? e.g. `(value-of-field-0 value-of-field-1 ...)'
<minima>it's easy to define a function for that but i was wondering if it can be done in a DRY way, without hardcoding the record fields in the "serialiser"
<RhodiumToad>which flavor of records?
<minima>strings and (flat) lists
<RhodiumToad>I mean, srfi-9 records, low-level records, rnrs records, goops classes?
<RhodiumToad>sor srfi-9 or builtin, you can probably synthesize the procedure you want using record-type-descriptor, record-type-fields, record-accessor
<RhodiumToad>*for
<minima>oh sorry! yes srfi-9
<minima>thanks RhodiumToad - do you know if the field order is guaranteed when accessing them via record-type-fields? i suppose yes, it is
<RhodiumToad>it's the same order as in the original declaration
<minima>brilliant, thanks!
<minima>RhodiumToad do you know if there's a way to get the list of field accessors?
<RhodiumToad>record-accessor
<minima>thanks!
<RhodiumToad>i.e. (map (cut record-accessor rtd <>) (record-type-fields rtd))
<minima>oh that's helpful, thanks
<RhodiumToad>cut is from srfi-something, i forget the number
<sarthalion>Arsen: Thanks!
<exc>hello, guile
<RhodiumToad>good afternoon
<apteryx>hi! is this a bug in ice-9 match's '..1' ? https://paste.debian.net/1292249/
<apteryx>I'd expect the documentation "..1 1 or more" to mean it's greedy
<apteryx>given that's how it works for '...'
<RhodiumToad>using ... or ..1 other than at the end of a list isn't documented?
<dsmith>sarthalion, One common problem, if installing from source, is forgetting to run ldconfig after the install.
<apteryx>RhodiumToad: I don't think it is
<sarthalion>dsmith: That's true :) However, it was just about naming this time
<sarthalion>-lguile-3.0 works (and pkg-config of course)
<dsmith>sarthalion, Cool. pkg-config to the rescue!
<ieugen>hi, how can I find out in which package a procedure is defined?
<ieugen>I am browsing https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/qtile.scm#L159 . And would like to know where to find `pypi-uri` ?
<ieugen>having procedures be imported in a global namespace makes this harder than it should IMO
<apteryx>RhodiumToad: do you think a bug should be reported for that behavior?
<apteryx>or is it correct per other Schemes?
<apteryx>RhodiumToad: someone in #scheme suggested Guile should error with invalid syntax when ... or ..1 is not used at the end of a list
<apteryx>*is used somewhere else than at the end of a list
<apteryx>I've opened bug#66057 for it
<euouae>Hello, how does procedure-documentation work?
<rlb>279
<rlb>euouae: in the end it's defined here: https://git.savannah.gnu.org/cgit/guile.git/tree/libguile/procprop.c?h=v3.0.9&id=9b20ca275dba758a194073936cde7c95311bd51e#n285 But that really just says that it looks for a 'documentation property associated with the procedure.
<rlb>Those properties can be set via https://www.gnu.org/software/guile/manual/html_node/Procedure-Properties.html
<rlb>But if you get familiar enough with that C code, you'll see it does a bit more than that, e.g. it falls back to scm_i_program_documentation(), which ends up in program-documentation, which will I believe look in any relevant .go file for a related elf section, etc.
<rlb>(So, not entirely trivial.)
<euouae>rlb, using procedure-documentation is unclear to me
<apteryx>we hahow do we call the arguments to macros?
<apteryx>*how
<apteryx>I think there was a fancy noun to use for them
<haugh>apteryx, (match (iota 3) ((foo ... bar) foo))
<apteryx>yes, that works, but should it? the documentation doesn't mention how it's supposed to behave
<apteryx>it mentions 'ooo' only at the end of a list pattern
<apteryx>ooo being either ... or ..1
<haugh>I disagree: I interpret the description of identifier as (pat_1 ... pat_n) as describing this behavior
<haugh>though I can see how you read it the other way
<haugh>Okay, now I see your point.
<haugh>I do remember struggling with this doc when I was jumping into Guile
<haugh>I certainly don't want to do away with that behavior though, since this is also how the syntax pattern matcher works
<haugh>minus the ___ and ..1 forms of course
<haugh>apteryx, apologies if I missed something but I believe what you wanted in your example expression was (pk 'path path ..1)
<haugh>Oh no I'm wrong, excuse me.
<RavenJoad>Is there a way to get guile's backtrace to print the entire backtrace line?
<haugh>Okay, so in ice-9/match.upstream.scm, the in-line documentation claims that both (foo ... bar) is supported and that ..1 "is exactly like the ... except that it matches one or more repitions", which we can clearly see is not how the implementation works according to the difference in outputs between (match '(0 1 2) ((foo ... bar) (foo)) => (0 1) and (match '(0 1 2) ((foo ..1 bar) foo)) => 0,
<haugh>in which ..1 => 1
<haugh>"... need not be the final element in the list, and may be succeeded by a fixed number of patterns."
<haugh>There's no match-two clause for pattern (p ..1 . r) like there is for (p ___ . r)
<haugh>;; Gimme some sugar baby.
<haugh>:/
<haugh>I just noticed that the match.upstream.scm has a comment style (and texinfo markup) that seems designed for procedural documentation that obviously isn't in the manual. Is this just an older way of documentation? It's the only documentation for some features.
<euouae>I'm still unsure on how to use procedure-documentation
<euouae>E.g. (procedure-documentation car) gives #f
<haugh>euouae, car has no docstring; try +
<rlb>euouae: right, it may not work for any given thing at the moment. If there aren't actually any docs attached, you'll get #f.
<haugh>see also procedure-properties
<rlb>Whether or not docs should be attached is another question...
<euouae>haugh: try +?
<haugh>(procedure-properties +)
<haugh>procedure-documentation accesses the 'documentation key of that properties alist, and then the ,document repl command wraps procedure-documentation
<rlb>I wondered the other day if we were missing docs where we expected them, i.e. do we expect the SCM_DEFINE docs to show up?