Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Sierpinski-triangle/F-Sharp/sierpinski-triangle.fs
Normal file
13
Task/Sierpinski-triangle/F-Sharp/sierpinski-triangle.fs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
let sierpinski n =
|
||||
let rec loop down space n =
|
||||
if n = 0 then
|
||||
down
|
||||
else
|
||||
loop (List.map (fun x -> space + x + space) down @
|
||||
List.map (fun x -> x + " " + x) down)
|
||||
(space + space)
|
||||
(n - 1)
|
||||
in loop ["*"] " " n
|
||||
|
||||
let () =
|
||||
List.iter (fun (i:string) -> System.Console.WriteLine(i)) (sierpinski 4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue