IRC channel logs

2022-04-27.log

back to list of logs

***daviid is now known as Guest1808
***daviid` is now known as daviid
<xiews>Why my (current-filename) is #f?
<apteryx>xiews: are you working from an REPL?
<apteryx>if so, that's how it is
<apteryx>what does '#:replace ((define-public* . define-public))' do in a use-modules directive?
<apteryx>it seems it should bind 'define-public' to define-public*, but that seems a bit unintuitive/backward
<apteryx>or I guess it I treat #:replace as a rename, it makes sense. rename define-public* to define-public, overriding any existing define-public. Is this correct?
<daviid>apteryx: #:replace 'Export all identifiers in list (a list of symbols or pairs of symbols) and mark them as replacing bindings...'
<daviid>it works like export, which means itcreates a new variableand a new binding, in that module whe re you use the declartion, then it exports it and marks as replace, which means your new definition will replce core binding for that name, define-public*
<xiews>apteryx: no, in script
<daviid>apteryx: if you just want torename define-public* as define-public in a module, don't use #:replace, but #:select
<daviid>iiuc
<xiews>apteryx: if it is #f, then (dirname (current-filename)) would raise exception.
<apteryx>xiews: I'm not sure then. I've only seen this when using the Geiser REPL
<apteryx>daviid: OK. I think it's intended to replace define-public everywhere it's used, not just in that module, that must be why replace is used
<apteryx>thank you
<apteryx>I'm trying to understand if a deficiency in preserving source location in a Guix-provided syntax can be overcome
<apteryx>The syntax is defined as define-public* here: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/packages.scm#n458
<apteryx>the problem is that in some case (syntax-source s) returns #f
<apteryx>for example when the package object is obtained via a procedure such as 'package-with-python2', which is a specialized version of https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build-system/python.scm#n82
<apteryx>here's an example package where the location is *not* correctly preserved: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/audio.scm#n4349
<daviid>apteryx: i have zero experience with source location and related maters ... i hope other(s) join and try(ies) to help ...
<xiews>apteryx: thank you
<apteryx>daviid: no problem :-) it seems there's something new in Guile 3.0.8 which may help with this, `read-syntax'
<apteryx>which annotates each datum as it reads them
<apteryx>but there's no mention of an interface to access the information. I guess it's still early days and low level.
<apteryx>also not sure how it can be switch on or if it can help in my specific case. Anyway, if some macro expert is keen to help, I've added some more information to this Guix bug ticket: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55139
<apteryx>what's the best way to remove a field from a record in sexp form, programmatically? the SXML module?
<apteryx>(I was thinking to filter out nodes of a certain name)
<apteryx>hm, just match for something simple is enough so far
<chrislck>sneek: botsnack
<sneek>:)
<mwette>apteryx: for procedure named foo, start with ,use (system vm program) (program-sources-pre-retire foo)
<sneek>Welcome back mwette, you have 1 message!
<sneek>mwette, lilyp says: the correct way to check for this kind of nil is null?
<mwette>not sure what you are looking for
<apteryx>mwette: was your answer with program-sources-pre-retire a way to force annotating a procedure foo with source information?
<apteryx>(hi!)
<xiews>(define a '((0 1 2)))
<xiews>(list-set! a 0 '(1 2 3))
<xiews>wrong type?
<wingo>should be an error, constant literals are immutable
<chrislck>xiews: you'll want (define a (list (list 0 1 2)))
<xiews>chrislck: OK, that's it.
<mwette>apteryx: no, I think that is a different interface. the internal representation of program source changed in 3.0.? so was wondering if a lower level function would see it
<apteryx>OK
<dsmith-work>{appropriate time} Greetings, Guilers
<chrislck>sneek: botsnack
<sneek>:)
<xiews>chrislck: how do I know if a list is constant?
<chrislck>i'm not aware of a mechanism to show it
<apteryx>how can I filter out a particular sexp based on its node name in a larger sexp? is this a job for xpath?
<mwette>xpath is intended for specific sexp forms, so maybe; also (sxml fold) may be useful
*mwette afk
<apteryx>thanks
<tribals>Hi, folks!
<tribals>Is it a good practice to use named let with typical `with-something-...` functions? Eg, it is a good practice to define `thunk` for `with-output-to-file`?
<stis>Tjaba guilers!
<stis>wingo: WDYT about one shot continuations?
<stis> http://itampe.com/one-shot-continuations.html
<stis>would probably be great for fibers!
<apteryx>mwette: it seems fold can be used to replace, but I want to remove items from the tree
<apteryx>there's a little glitch in the manual; (sxpath1 '//) --> (sxpath1 '(//))
<mwette>I have used tfold to remove. See https://git.savannah.nongnu.org/cgit/nyacc.git/tree/examples/nyacc/lang/javascript/compile-tree-il.scm?h=main#n861
<leth>How do you make a let binding in a syntax case use the literal symbol provided and make it available to macros inside that syntax case?
<leth>*literal datum/symbol name.
<apteryx>do we have a tree-filter equivalent in Guile? like this, basically: https://docs.racket-lang.org/lazytree/index.html#%28def._%28%28lib._data%2Flazytree..rkt%29._tree-filter%29%29
<apteryx>ugh, I'm trying to use foldts*, can't wrap my heard around it
<apteryx>I have this sexp: '((quasiquote ((python2-variant unquote (delay python2-pytest-warnings)) (superseded unquote python-pytest)))) which I want to transform into: '((quasiquote ((superseded unquote python-pytest))))