Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Four-is-magic/F-Sharp/four-is-magic-1.fs
Normal file
8
Task/Four-is-magic/F-Sharp/four-is-magic-1.fs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//Express an Integer in English Language. Nigel Galloway: September 19th., 2018
|
||||
let fN=[|[|"";"one";"two";"three";"four";"five";"six";"seven";"eight";"nine"|];
|
||||
[|"ten";"eleven";"twelve";"thirteen";"fourteen";"fifteen";"sixteen";"seventeen";"eighteen";"nineteen"|];
|
||||
[|"";"";"twenty";"thirty";"fourty";"fifty";"sixty";"seventy";"eighty";"ninety"|]|]
|
||||
let rec I2α α β=match α with |α when α<20 ->β+fN.[α/10].[α%10]
|
||||
|α when α<100 ->I2α (α%10) (β+fN.[2].[α/10]+if α%10>0 then " " else "")
|
||||
|α when α<1000 ->I2α (α-(α/100)*100) (β+fN.[0].[α/100]+" hunred"+if α%100>0 then " and " else "")
|
||||
|α when α<1000000->I2α (α%1000) (β+(I2α (α/1000) "")+" thousand"+if α%100=0 then "" else if (α-(α/1000)*1000)<100 then " and " else " ")
|
||||
6
Task/Four-is-magic/F-Sharp/four-is-magic-2.fs
Normal file
6
Task/Four-is-magic/F-Sharp/four-is-magic-2.fs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
let rec printI2α=function |0->printf "naught->"; printI2α 6
|
||||
|4->printfn "four is magic"
|
||||
|n when n<0->let g = I2α -n "minus " in printf "%s->" g; printI2α (g.Length)
|
||||
|n ->let g = I2α n "" in printf "%s->" g; printI2α (g.Length)
|
||||
let N=System.Random()
|
||||
List.init 25 (fun _->N.Next 999999) |> List.iter printI2α
|
||||
Loading…
Add table
Add a link
Reference in a new issue