top of page
Screenshot from 2020-06-23 09-15-39.png

Functions

A number of operators, like map and select, take Python functions as command-line arguments. Functions can also be invoked to provide function arguments. For example, to list the contents of your home directory, you could write:

ls /home/(USER)

(USER) is a function, which is shorthand for (lambda: USER), (marcel permits the lambda keyword to be omitted). /home/(USER) concatenates the string /home/ with the string resulting from the evaluation of the expression lambda: USER. USER is a marcel environment variable identifying the current user, so this command is equivalent to ls ~.

If you simply want to evaluate a Python expression, you could use the map operator, e.g.

map (5 + 6)

 

which prints 11. In a situation like this, marcel also permits you to omit map; it is implied, so this also works:

 

(5 + 6)

bottom of page