Re: A better way to access records.

2020-11-13 Thread Brendan Tildesley
On 1/11/20 8:01 am, Ludovic Courtès wrote: Hi, Brendan Tildesley skribis: In the guix codebase, on many occasions there appear things like this: (match-lambda     (($ agetty tty term baud-rate auto-login     login-program login-pause? eight-bits? no-reset? remote? flow-control?  

Re: A better way to access records.

2020-10-31 Thread Ludovic Courtès
Hi, Brendan Tildesley skribis: > In the guix codebase, on many occasions there appear things like this: > > (match-lambda >     (($ agetty tty term baud-rate auto-login >     login-program login-pause? eight-bits? no-reset? remote? > flow-control? >     host no-issue? init-string no-cle

Re: A better way to access records.

2020-10-30 Thread Danny Milosavljevic
Hi Brendan, On Fri, 30 Oct 2020 21:59:59 +1100 Brendan Tildesley wrote: > No I didn't want to specify the fields at all, just have all of them > automatically defined. I think that that is a bad idea for maintenance reasons. This totally would hide variables from the enclosing context without

Re: A better way to access records.

2020-10-30 Thread Taylan Kammer
On 30.10.2020 11:28, Brendan Tildesley wrote: In the guix codebase, on many occasions there appear things like this: (match-lambda (($ agetty tty term baud-rate auto-login login-program login-pause? eight-bits? no-reset? remote? flow-control? host no-issue? init-string no-cl

Re: A better way to access records.

2020-10-30 Thread Bengt Richter
Hi Brendan, On +2020-10-30 21:28:38 +1100, Brendan Tildesley wrote: > From the little bit of SICP that I've done, I recall watching the lectures > where > they put a mage hat on and talk about the power of names. One could perhaps > say > the most powerful tool in a programming language is the abi

Re: A better way to access records.

2020-10-30 Thread Brendan Tildesley
On 30/10/20 8:49 pm, Leo Prikler wrote: Well, the "functional" way of accessing them all in one go would be to (map (cute <> foo) (list package-name package-version package-...)) But I assume you want syntax like (let-field record field exp*) (let-fields record (field1 field2...) exp*) No I d

Re: A better way to access records.

2020-10-30 Thread Leo Prikler
Well, the "functional" way of accessing them all in one go would be to (map (cute <> foo) (list package-name package-version package-...)) But I assume you want syntax like (let-field record field exp*) (let-fields record (field1 field2...) exp*) analogous to (srfi srfi-9 gnu) set-field and se

A better way to access records.

2020-10-30 Thread Brendan Tildesley
From the little bit of SICP that I've done, I recall watching the lectures where they put a mage hat on and talk about the power of names. One could perhaps say the most powerful tool in a programming language is the ability to give something a name and then refer to those names. In guix/guile,