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: Mon, 10 Feb 2020 08:43:36 +0100

On Mon, 10 Feb 2020 at 07:31, Ricardo Wurmus <address@hidden> wrote:
> zimoun <address@hidden> writes:


> >> * It’s not possible to select more than one tagged item
> >>
> >>   In my test workflow I’m generating a bunch of inputs by mapping over
> >>   an argument list.  Now the problem is that I can’t select all of these
> >>   inputs easily in a code snippet.  With the syntax we have I can only
> >>   select the first item following a tag.
> >>
> >>   To address this I’ve extended the accessor syntax, so this works now:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> process frobnicate
> >>   packages "frobnicator"
> >>   inputs
> >>     . genome: "hg19.fa"
> >>     . samples: "a" "b" "c"
> >>   outputs
> >>     . "result"
> >>   # {
> >>     frobnicate -g {{inputs:genome}} --files {{inputs::samples}} > 
> >> {{outputs}}
> >>   }
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >>   Note how {{inputs::samples}} is substituted with “a b c”.  With just a
> >>   single colon it would be just “a”.  Single colon = single item; double
> >>   colon = more than one item.
> >
> > I am confused by the syntax.
> > Well how to select the second element "b"?
> >
> > Naively, I would tempt to write {{inputs:samples:2}} or 
> > {{inputs::samples:2}}.
>
> There’s no syntax for that because you can use good ol’ list processing
> (let’s call it “Listp”, or perhaps “Lisp”…) to work on this outside of
> the code snippet.

If I understand correctly, for such cases, 3 solutions:

1. manually split

 inputs
   . sample-1: "a"
   . sample-2: "b"
   . sample-3: "c"

or 2. split elsewhere 'samples' using piece of Lisp

or 3. use Lisp features

 inputs
   . sample-1: `(list-ref ,samples 1)
   . sample-2: `(list-ref ,samples 2)
   . sample-3: `(list-ref ,samples 3)


Right?



> My hope is that in-list access is much less common and could either be
> rewritten to place the item of interest in the first place, or could be
> solved with a let binding.

It makes sense to me.


All the best,
simon



reply via email to

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