gwl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preparing for a new release


From: zimoun
Subject: Re: Preparing for a new release
Date: Tue, 11 Feb 2020 00:43:12 +0100

Hi,

On Mon, 10 Feb 2020 at 22:28, Ricardo Wurmus <address@hidden> wrote:

> > Right?
>
> That’s correct, but to directly access values in the “inputs” field,
> though, you’d have to use a let binding around the definition of the
> code snippet, which would be uglier.
>
> So ugly in fact that I decided to write this little procedure:

Wow! :-)


> --8<---------------cut here---------------start------------->8---
> ;; Simplify access to tagged items in lists.
> (define pick

[...]

>         ;; SRFI-1 accessors like "first"
>         ((procedure? n)
>          (n sub))

Cool!

>         (else (error "pick: Selector not supported.")))))))
> --8<---------------cut here---------------end--------------->8---
>
> Then I noticed that it’s really inconvenient to use let bindings inside
> of fields, so I changed the “make-process” macro to allow for
> definitions inside of the fields of a process.

Ok. Even I am a bit lost with all the changes.


> So you can do this now:
>
> --8<---------------cut here---------------start------------->8---
> process foo
>   inputs
>     . "something"
>     . samples: "a" "b" "c"
>   procedure
>     define second-sample
>       pick second samples: inputs
>     . # { echo {{second-sample}} }
> --8<---------------cut here---------------end--------------->8---
>
> Unfortunately, the leading dot sticks out like a wart here.  We could
> only drop it if I manage to rewrite the code-snippet value so that it
> really is a procedure that will return itself when applied to zero
> arguments…  It might be possible with some tinkering.

Hum? I trust you.

> (Note that you do need the “procedure” field name here; it can be left
> off only when the last value is a code-snippet.)

Ok. It makes sense.

Does this work?

 --8<---------------cut here---------------start------------->8---
 process foo
   inputs
     . "something"
     . samples: "a" "b" "c"
     # { echo {{(pick second inputs:samples)}} }
 --8<---------------cut here---------------end--------------->8---

or   # { echo {{(pick second samples: inputs)}} }

Because it is enough to usual needs, I guess.


Cheers,
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]