IRC channel logs

2021-06-26.log

back to list of logs

<dsmith>!since
<sneek>I've been running for 21 hours
<apteryx>hello! I'm surprised that this is not valid: https://paste.debian.net/1202456/. It seems to be because in the template, each variable must be immediately followed by the ellipsis ...
<apteryx>Ideas?
<apteryx>substitute* is a macro from (guix build utils); see: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm#n793.
<apteryx>I want the macro to expand into multile substitute* usages (one per file).
<apteryx>seems I'm forced to strip the last ... and manually repeatedly use the 'disable-tests' macro
<leoprikler>apteryx I think you'll need to express that as a syntax-case, but I can't help you write it :P
<lampilelo>apteryx: i think just wrapping substitute call and the ellipsis with begin should work
<bricewge>How can I get from such data sctrucutre “'(("user" . ("alice" "bob" "eve")) ("admin" . ("alice")))” to “'(("alice" . ("admin" "user")) ("bob" . ("user")) ("eve" . ("user")))”?
<bricewge>Should I use alist in that case?
<leoprikler>bricewge: first (append-map cdr groups+users) and delete-duplicates
<leoprikler>that gives you a list of users
<leoprikler>then per user (filter-map (lambda (group) (and (member user group) (car group))) groups+users)
<leoprikler>gives you a list of groups, which finally you can cons to the users to get the restructured alist
<leoprikler>your data is already an alist, so that works out
<bricewge>leoprikler: Thanks a bunch, it works!
<bricewge>Is that a convention to call alist key+value, like the previous groups+users?
<lampilelo>alist is a list of pairs
<lampilelo>alist = association list
<bricewge>Yes, but is it a convention to name an alist variable "key+value" as leoprikler did with "groups+users"?
<lampilelo>not really
<tekakutli>hello gentlement, finally decided to give guile a go
<bricewge>lampilelo: Thanks
<tekakutli>I have a question: what t
<tekakutli>what does # mean?
<tekakutli>like #f or #:key
<lampilelo>it depends on a context, #:foo is a keyword, which is just like a symbol but (symbol? #:foo) => #f and (keyword? 'foo) => #f
<lampilelo>#f and #t are booleans, don't have anything to do with keywords
<lampilelo>and #\z is a char 'z'
<tekakutli>thanks, I know, I was refering specifically to the #
<tekakutli>but yea, I guess its contextual
<lampilelo>by itself it doesn't mean anything, just a part of a syntax
<tekakutli>thanks lampilelo
<leoprikler>bricewge: key+value is a semantic variable here, you can name your variables however you want
<leoprikler>I personally do write this occasionally and there's also a procedure called car+cdr which for alists exactly produces key+value as multiple values
*leoprikler → afk again
<mwette>I think of # as telling the reader the next character is special; #\ for chars, #x for hex numbers, #; for comment #{ for symbol, ... There is a section in the manual about adding your own https://www.gnu.org/software/guile/manual/html_node/Reader-Extensions.html#Reader-Extensions
<chrislck>even more confusing #(1 2 3) is shorthand for (vector 1 2 3)
<chrislck>and wingo has uncovered some unusual bugs involving # recently in the reader
<mwette>I've used # to allow in-line expressions from other languages: https://paste.debian.net/1202498/
<dsmith>#/ice-9/foo used to be reader syntax for modules
<rlb>wingo: while I'm still not certain I understand things well, I wondered if this might be feasible as a follow up to 0cc799185576712d69f11fc794454f2f5447bef7:
<rlb>--- a/module/ice-9/psyntax.scm
<rlb>+++ b/module/ice-9/psyntax.scm
<rlb>@@ -2157,6 +2157,8 @@
<rlb> (lambda ()
<rlb> (gen-syntax src #'(e1 e2 ...) r maps ellipsis? mod))
<rlb> (lambda (e maps) (values (gen-vector e) maps))))
<rlb>+ (x (eq? (syntax->datum #'x) #nil)
<rlb>+ (values '(quote #nil) maps))
<rlb> (() (values '(quote ()) maps))
<rlb> (_ (values `(quote ,e) maps))))))
<rlb>
<rlb>
<rlb>O'
<rlb>I'll need to triple-check, but that just includes a case for #nil alongside the patch's original case for (), and it does fix the problems with lokke.