From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:56423) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j12bt-0000gQ-7M for gwl-devel@gnu.org; Mon, 10 Feb 2020 01:31:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j12bs-0004un-1s for gwl-devel@gnu.org; Mon, 10 Feb 2020 01:31:57 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21128) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j12br-0004kn-IJ for gwl-devel@gnu.org; Mon, 10 Feb 2020 01:31:56 -0500 References: <87h801p818.fsf@elephly.net> <87h800u84z.fsf@kyleam.com> <87a75spx3i.fsf@elephly.net> <877e0vq5iy.fsf@elephly.net> From: Ricardo Wurmus Subject: Re: Preparing for a new release In-reply-to: Date: Mon, 10 Feb 2020 07:31:45 +0100 Message-ID: <875zgfosvi.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+kyle=kyleam.com@gnu.org Sender: "gwl-devel" To: zimoun Cc: gwl-devel@gnu.org zimoun writes: >> * It=E2=80=99s not possible to select more than one tagged item >> >> In my test workflow I=E2=80=99m generating a bunch of inputs by mappin= g over >> an argument list. Now the problem is that I can=E2=80=99t 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=E2=80=99ve extended the accessor syntax, so this wor= ks 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}} > {{outp= uts}} >> } >> --8<---------------cut here---------------end--------------->8--- >> >> Note how {{inputs::samples}} is substituted with =E2=80=9Ca b c=E2=80= =9D. With just a >> single colon it would be just =E2=80=9Ca=E2=80=9D. Single colon =3D s= ingle item; double >> colon =3D 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=E2=80=99s no syntax for that because you can use good ol=E2=80=99 lis= t processing (let=E2=80=99s call it =E2=80=9CListp=E2=80=9D, or perhaps =E2=80=9CLisp=E2= =80=9D=E2=80=A6) to work on this outside of the code snippet. To me these two cases =E2=80=94 accessing a single item and accessing multi= ple items =E2=80=94 are just really common enough to deserve their own syntax, especially because the plain Scheme way to do this is rather dense: (and=3D> (memq inputs #:hello) cadr) and (and=3D> (memq inputs #:hello) (lambda (sublist) (break keyword? (cdr sublist)))) I wouldn=E2=80=99t want to see bioinformaticians paste these kind of things= all over the place. 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. -- Ricardo