Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Mayan-numerals/F-Sharp/mayan-numerals.fs
Normal file
10
Task/Mayan-numerals/F-Sharp/mayan-numerals.fs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Mayan numerals. Nigel Galloway: February 19th., 2021
|
||||
let N=[|"│ ";"│. ";"│.. ";"│... ";"│....";"│~~~~"|]
|
||||
let fN g=(fun(n)->if g=0 && n=0 then "│ Θ " else N.[let g=g-5*n in if g>4 then 5 else if g<0 then 0 else g])
|
||||
let rec fG n g=match n/20L,n%20L with (0L,0L)->(g,List.length g) |(i,n)->fG i ((fN(int n))::g)
|
||||
let mayan n=let n,g=fG n []
|
||||
printf "┌────"; for _ in 2..g do printf "┬────"
|
||||
printfn "┐"; for g in 3.. -1 ..0 do n|>List.iter(fun n->printf "%s" (n(g))); printfn "│"
|
||||
printf "└────"; for _ in 2..g do printf "┴────"
|
||||
printfn "┘"
|
||||
[4005L;8017L;326205L;886205L]|>List.iter(fun n->printfn "%d" n; mayan n)
|
||||
Loading…
Add table
Add a link
Reference in a new issue