E𝄪

From Esolang
Jump to navigation Jump to search

In music, there are a couple rare marks known as "Double flat" and "Double sharp". While a sharp or a flat raises or lowers the pitch half a tone, respectively, double flats and double sharps raise or lower the pitch one full tone. Since F# is one full tone above E, E double sharp IS F# (in 12tet though). Therefore, the language E𝄪 IS F# as well (assuming we're using a 12tet harmony).

Pronunciation

E𝄪 is pronounced "Ee Double Sharp"."

Examples

Hello World:

[<EntryPoint>]
let main argv = 
    printfn "Hello, World!"
    0 

Quine:

let s : Printf.TextWriterFormat<_> = "let s : Printf.TextWriterFormat<_> = %c%s%c in
printf s (char 34) (s.Value) (char 34)" in printf s (char 34) (s.Value) (char 34)

FizzBuzz:

let fizzbuzz n = 
    let divisibleBy m = (n % m) = 0
    match divisibleBy 3,divisibleBy 5 with
        | true,false -> "fizz"
        | false,true -> "buzz"
        | true,true -> "fizzbuzz"
        | false,false -> sprintf "%d" n

[1..15] |> List.map fizzbuzz 

Game of Life:

open System

let grid = "
00000000
00110000
00010000
00110000
00001000
00000000
00000000
00000000
"
let generation (grid:string) =
    let size = 8
    let lines = grid.Split([|'\r';'\n'|])
    let lines = lines |> Array.filter (fun line -> line.Length > 0)
    let computeNeighbours x y =
        [-1,-1; 0,-1; 1,-1
         -1, 0;       1, 0
         -1, 1; 0, 1; 1, 1]
        |> List.map (fun (dx,dy) ->
            let x,y = x+dx, y+dy
            if x >=0 && x < size && y >= 0 && y < size &&
               lines.[y].Chars(x) = '1'
            then 1
            else 0
        ) |> List.sum

    let life x y c =       
        match c, computeNeighbours x y with
        | '1' , 2 -> c
        |  _ , 3 -> '1'
        |  _ , _ -> '0'
    
    lines |> Array.mapi (fun y line ->
        let chars =
            line.ToCharArray() |> Array.mapi (fun x c ->
                life x y c
            )
        String(chars)
    )
    |> String.concat "\r\n"

printfn "%s" grid

do System.Console.ReadLine() |> ignore