Definition
A Dyck path of length \$2n\$ can be defined as a two-dimensional path such that:
- The path consists of straight lines of equal length.
- The path goes left to right while moving either up or down. Each step is an up-right or down-right slanted line.
- The final and initial heights of the path are the same, and the path never goes below that height.
Here is an example for \$n=4\$:
/\/\ / \/\ The number of Dyck paths of length \$2n\$, \$n \geq 1\$ is the \$n\$-Catalan number: \$1\$, \$2\$, \$5\$, \$14\$, \$42, \ldots\$
The challenge
Given \$n \geq 1\$, draw all Dyck paths of length \$2n\$ in ASCII art, using characters /, \, space and newline.
Blank space around the path is fine.
The paths can be output in any order, without repetitions.
Additional rules
- Input and output means are flexible as usual. For example, the paths can be directly displayed, or output as a string with newlines, or as an array of strings where each string is line of output. If the paths are directly displayed, they should be clearly separated by blank space.
- Programs or functions are allowed.
- Standard loopholes are forbidden.
- The shortest code in bytes wins.
Test cases
Additional test cases can be generated with this program (not golfed).
\$n=1\$:
/\ \$n=2\$:
/\/\ /\ / \ \$n=3\$:
/\/\/\ /\ /\/ \ /\ / \/\ /\/\ / \ /\ / \ / \ \$n=4\$:
/\/\/\/\ /\ /\/\/ \ /\ /\/ \/\ /\/\ /\/ \ /\ / \ /\/ \ /\ / \/\/\ /\ /\ / \/ \ /\/\ / \/\ /\/\/\ / \ /\ /\/ \ / \ /\ / \ / \/\ /\ / \/\ / \ /\/\ / \ / \ /\ / \ / \ / \