IRC channel logs

2025-03-08.log

back to list of logs

<anemofilia>Just discovered that (define lst '(b)) `(a . ,@lst) doesn't do what I thought it would do
<old>anemofilia: looks like a bug
<anemofilia>old: In sbcl this issues an error, you can't use unquote-splicing in the cdr. I think the intention is clear and it should be supported, though
<shawnw>Guile, Chicken, Chibi all return (a unquote-splicing lst). Gauche and Kawa raise errors about invalid use of unquote-splicing.
<shawnw>Chez acts like Guile; MIT scheme raise an error. I'm running out of installed schemes to try...
<dpk>the cdr of a pair is a single-valued slot. you can’t splice multiple values into it
<dpk>regular unquote should do what you want there
<anemofilia>dpk: Note that the list I'm unquote-splicing has a single element
<anemofilia>Also, unquote doesn't do what I want
<anemofilia>I want to achieve `(a . b)
<anemofilia>`(a . ,lst) gives me `(a b)
<sneek>dsmith: Greetings
<old>anemofilia: `(a . ,lst) is equivalent to: (cons a lst). if lst is (b) then it is normal to get (a b)
<anemofilia>old: Yes, I know, I'm saying that's not the object I was trying to construct with `(a . ,@lst)
<anemofilia>I was trying to construct `(a . b)
<anemofilia>The intent of `(a . ,@lst) is very clear: To splice lst and put it single element in the cdr position of the pair
<anemofilia>s/it/it's/
<old>I agree
<old>I would expect that
<dthompson>`(a . ,@lst) doesn't make sense
<anemofilia>dthompson: Why not?
<anemofilia>It indeed would not make sense is lst were anything besides a single element list
<anemofilia>But in that case I think it's fairly reasonable, as I said a couple messages before
<anemofilia>s/is/if/
<dthompson>unquote-splicing is basically just a cons
<dthompson>which is why it doesn't make sense with dot notation, which is also a cons
<old>I guess it would make sens if . was cons*
<anemofilia>dthompson: But that's the implementation view of unquoting-splicing, as heuristic what it does is removing the parenthesis that enclose the list elements. Supporting the . ,@ use-case would make it consistent with respect to that heuristic, despite needing a different implementation
<dthompson>no I don't think so
<anemofilia>Anyway, if this is not supported, I think it should issue an error, returning (a unquote-splicing lst) is very inconvenient
<anemofilia>There's only one reasonable semantic for `(a . ,@lst), and (a unquote-splicing lst) isn't that semantic
<dthompson>maybe it would be possible to throw an error, yeah, but what you're suggesting isn't reasonable given how these syntax forms work
<Minall>Hello Guile Community!
<Minall>Is anyone using Emacs to debug in Guile?, I wonder about the 'bridge' about Emacs Lisp and Guile, and how they can complement each other. In Elisp for example, there's an amazing way to debug a lot of things, I can go to any function I'm calling in that moment and debug. I wonder if I can do something similar on Guile, like see the function that I am calling, debug it, etc, etc
<old>Minall: My experience of debugging Guile is has been terrible. The only reliable things I've manage to do is print debugging
<old>which works okay most of the time, but whenever you enter multi-threads land, good luck with that
<Minall>old: no way... I often work with Elisp, and I like the debugging experience. I was expecting something similar... I mean, to write more complex stuff. But iwth good debugging
<Minall>I'll take a look
<old>maybe others had a better experience than me
<old>Guile is the only Lisp I've worked with and my only debugging experience is with GDB with C
<old>so maybe I'm just not understanding how to use a REPL to debbug effectively
<dsmith>sneek, botsnack
<sneek>:)
<mwette>guile-1.8 had a good debugger
<old>mwette: when was that? Begining of 2000?
<mwette>old: yes
<mwette>Once in a while I dig into guile and try to figure out how to make the debugging better. It's been a big challenge for me.
<old>mwette: it's the kind of things that ought to be part of toolchains around the runtimes. Trying to implement it outside of the runtime is probably very complex or simply not possible
<mwette>old: this is like python pdb.set_trace(): https://github.com/mwette/guile-jtd
<mwette>my thinking has been that the meta info in the .go dwarf has to be extended to include local binding info etc
<old>mwette: yes I agree
<ArneBab>anemofilia: do you need `(a . ,(car lst)) ?
<ArneBab>Minall: I’m debugging by either getting a REPL at the point I need (usually needs some code adaptions to expose a cooperative REPL) or just with the error messages. But to get a good experience, I need a REPL, and in that I just look at ,help debug
<ArneBab>Minall: see for example https://files.dthompson.us/docs/chickadee/latest/Live-Coding.html
<anemofilia>ArneBab: That's how I ended up doing it, yes