Factorial in APL

Example for versions Dyalog APL 13.1

This example calculates factorial of a number N by applying multiplication reduction to a list of numbers from 1 to N, inclusive (expression ×/1+⍳). The anonymous D-function applies this expression to its right argument and concatenates the result with the argument itself and a string separator. Note that in this case the string is not boxed. The function, in turn, is applied to a list of numbers from 0 to 16, written in a column, i.e. as a two-dimensional 17x1 array. Program output looks like this:

 ┌→───────────────────┐      
 ↓0 != 1              │      
 ├+──────────────────→┤      
 │1 != 1              │      
 ├+──────────────────→┤      
 │2 != 2              │      
 ├+──────────────────→┤      
 [...25 lines of output ...]  
 ├+──────────────────→┤      
 │16 != 20922789888000│      
 └+──────────────────→┘
IO0
PP18
{, '!=', ×/1+⍳⍵}¨17 1⍴⍳17