Phrases/Const Enum

From J Wiki
Jump to navigation Jump to search

Enumeration

Generate a set of names in current locale initialized with a sequence of numbers. Optional left argument provides sequence start number, with zero as default.

enum_z_=: 0&$: : (4 : '(y)=: x + i.>: '' '' +/@:= y')

Examples

   enum 'ALPHA BETA GAMMA'
0 1 2

   10 enum 'ALPHA BETA GAMMA'
10 11 12

   ALPHA,BETA,GAMMA
10 11 12