Stupid marcel tricks
Compute 100!
â€‹

gen 100 1: Generates 100 integers starting with 1.

red *: Reduce using multiplication.
Distribution of word lengths
â€‹

cat /usr/share/dict/words: Generate a stream of words, from /usr/share/dict/words. This uses the host executable cat.

map (w: (len(w), 1)): For each input word, generate an output tuple containing the length of the word and the number 1.

red . +: Group by word length, and sum up the 1s.

Sort the tuples.
â€‹
Calculator
â€‹
Marcel can be used as a calculator, by writing an expression inside parentheses. The command below computes the golden ratio. It is equivalent to using the map operator with a zerofunction argument, i.e. map (lambda: (1 + sqrt(5)) / 2).
FizzBuzz
â€‹
A traditional "low bar" job interview question is to implement FizzBuzz: For the integers 1 through 100, print Fizz if the number is divisible by 3, Buzz if divisible by 5, FizzBuzz if divisible by both, and the
number itself otherwise. Here it is as a marcel command: