From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:43222) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyXYt-00067A-Fh for gwl-devel@gnu.org; Mon, 03 Feb 2020 03:58:32 -0500 Message-ID: Subject: Re: Comments on process template syntax From: Roel Janssen Date: Mon, 03 Feb 2020 09:58:28 +0100 In-Reply-To: <871rrdthmz.fsf@elephly.net> References: <871rrdthmz.fsf@elephly.net> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Ricardo Wurmus , gwl-devel@gnu.org On Sun, 2020-02-02 at 11:20 +0100, Ricardo Wurmus wrote: > Hi, > > While looking at the examples at > https://www.guixwl.org/beyond-started, > I found that process templates might be difficult to understand, and > that they have no pretty syntax. > > --8<---------------cut here---------------start------------->8--- > process: (list-file-template filename) > name > string-append "list-file-" > basename filename > packages "gzip" > inputs filename > outputs > string-append filename ".list" > run-time > complexity > space 20 mebibytes > time 30 seconds > # { gzip --list {{inputs}} > {{outputs}} } > --8<---------------cut here---------------end--------------->8--- > > The first line is easy to understand for lispers but it might look > weird > to people who come from other workflow languages or programming > languages. This describes a procedure called “list-file-template” > that > returns a process parameterized on the argument “filename”. > > Nextflow has no concept of procedures that produce processes when > given > arguments. It does however have a concept of data streams that can > be > fed into processes, which results in a process to be instantiated for > every element of the stream. The stream may be created from a > directory > containing files. > > This implementation likely stems from the realization that the > “template > case” is the most common case for processes. Rarely ever is it > necessary to define a process that does *not* require > parameterization > on its inputs. > > Can we make the common case simpler and easier to understand? Perhaps with some parentheses? That it is a Lisp is a good thing, not something you'd rather hide.. :) Like you've said; what you've defined above is a procedure, not a record. That's a really cool "feature" of the GWL! Maybe we can just clarify the feature better in the documentation. Here's my initial thought: --- When defining processes, they can be parameterized by turning the process definition into a procedure, which will form a template for processes to be defined later. This is done by adding a name for the template, and its parameters directly after "process:". --- Kind regards, Roel Janssen