CRalphabet

From Esolang
Jump to navigation Jump to search

CRalphabet is a joke(ish) language created by Splat. CRab takes '\n' and 'SPACE' as its only commands/arguments. Source code is comprised of varying length strings of \n. The number of \n's denotes an alphabetical character(a-z). This character is then printed out to the console.The 'SPACE' keyword denotes printing " " to the screen.

Example

The following code prints "hello world" to the console.

\n\n\n\n\n\n\n\n
\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
SPACE
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n

Implementation

Implementation in Haskell:

main = interact $ map cmd . words
cmd "SPACE" = ' '
cmd l | l == concat (replicate n "\\n") = ['`'..'z'] !! n
    where n = length l `div` 2