top of page

Pipelines and Variables

Updated: Oct 25, 2023

Most interaction with marcel involves the execution of a pipeline. For example:

ls -fr | select (f: now() - f.mtime < days(1))

ls explores the current directory recursively (-r), returning only files (-f). The resulting File objects are piped to the select operator, which keeps only those that have changed in the past day.

You write a command like this, hit return, get your result. But you can also store a pipeline in a variable for later execution, much as you would when writing a function in any programming language.

To store the above command in a variable, use conventional assignment notation, putting the pipeline inside brackets:

recent = (| ls -fr | select (f: now() - f.mtime < days(1)) |)

You can run this command at any time by just using the variable as if it were an operator:


You can also parameterize a pipeline. For example, the following pipeline explores the current directory recursively, and locates files with a given extension, (e.g. .py in

ext = (| e: ls -fr | select (f: f.suffix == e) |)

You can now run this pipeline, providing the extension of interest either as an argument:

ext .py

Or using flag notation, where the flag name is determined by the parameter's name:

exp -e .py

48 views0 comments

Recent Posts

See All

Marcel in more places

Thanks to two different pilot errors on my part, I have broken the packaging system of two OSes that package marcel. I would have had no idea they were including marcel otherwise. In any case, I'm hap

Marcel and Jupyter

For years, I kept hearing about iPython, as a vastly improved Python REPL. I played with it a little bit, and yes, I saw that. I found that Object Shell (a forerunner of marcel) ran in iPython with no


bottom of page