Author: | missingfaktor |
---|---|
Mode: | factor |
Date: | Thu, 22 Dec 2011 07:57:38 |
! A simple program that generates Excel spreadsheet column id corresponding to given column number. ! For example: ! 14 - N ! 26 - Z ! 27 - AA ! 29 - AC : alphabet ( -- seq ) CHAR: A CHAR: Z [a,b] ; : nth-char ( n -- char ) 1 - alphabet nth 1string ; : column-id ( i -- str ) dup 26 <= [ nth-char ] [ (column-id) ] if ; : (column-id) ( i -- str ) 26 [ /i column-id ] [ mod nth-char ] 2bi append ;