Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Sierpinski-carpet/Racket/sierpinski-carpet.rkt
Normal file
10
Task/Sierpinski-carpet/Racket/sierpinski-carpet.rkt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#lang racket
|
||||
(define (carpet n)
|
||||
(if (zero? n)
|
||||
'("#")
|
||||
(let* ([prev (carpet (sub1 n))]
|
||||
[spaces (regexp-replace* #rx"#" (car prev) " ")])
|
||||
(append (map (λ(x) (~a x x x)) prev)
|
||||
(map (λ(x) (~a x spaces x)) prev)
|
||||
(map (λ(x) (~a x x x)) prev)))))
|
||||
(for-each displayln (carpet 3))
|
||||
Loading…
Add table
Add a link
Reference in a new issue