Task
Produce a graphical or ASCII-art representation of a Sierpinski carpet of order   N.



For example, the Sierpinski carpet of order   3   should look like this:

###########################
# ## ## ## ## ## ## ## ## #
###########################
###   ######   ######   ###
# #   # ## #   # ## #   # #
###   ######   ######   ###
###########################
# ## ## ## ## ## ## ## ## #
###########################
#########         #########
# ## ## #         # ## ## #
#########         #########
###   ###         ###   ###
# #   # #         # #   # #
###   ###         ###   ###
#########         #########
# ## ## #         # ## ## #
#########         #########
###########################
# ## ## ## ## ## ## ## ## #
###########################
###   ######   ######   ###
# #   # ## #   # ## #   # #
###   ######   ######   ###
###########################
# ## ## ## ## ## ## ## ## #
###########################

The use of the   #   character is not rigidly required for ASCII art.

The important requirement is the placement of whitespace and non-whitespace characters.



Related task

   Sierpinski triangle


(fn in-carpet? [x y]
  (if
    (or (= 0 x) (= 0 y)) true
    (and (= 1 (% x 3)) (= 1 (% y 3))) false
    (in-carpet? (// x 3) (// y 3))))
 
(fn make-carpet [size]
  (for [y 0 (- (^ 3 size) 1)]
    (for [x 0 (- (^ 3 size) 1)]
      (if (in-carpet? x y)
        (io.write "#")
        (io.write " ")))
    (io.write "\n")))
 
(for [i 0 3]
  (make-carpet i)
  (print))