Course of Raku / Advanced / Operators / Meta-operators / Exercises

Every factorial at once

Problem

A single [*] reduction gives one factorial. Your task is to print every factorial from 1! up to 6! on a single line, in order, using one reduction. Use the triangular form of the reduction meta-operator so that all the intermediate products are kept, not just the final one.

Example

The program prints the list of factorials of 1 through 6:

(1 2 6 24 120 720)

Solution

See the solution

Course navigation

Solution: Average of an array   |   Solution: Every factorial at once