Task
Produce an ASCII representation of a Sierpinski triangle of order   N.



Example
The Sierpinski triangle of order   4   should look like this:

                       *
                      * *
                     *   *
                    * * * *
                   *       *
                  * *     * *
                 *   *   *   *
                * * * * * * * *
               *               *
              * *             * *
             *   *           *   *
            * * * *         * * * *
           *       *       *       *
          * *     * *     * *     * *
         *   *   *   *   *   *   *   *
        * * * * * * * * * * * * * * * *



Related tasks
 Sierpinski triangle/Graphical for graphics images of this pattern. 
 Sierpinski carpet


package require Tcl 8.5
 
proc map {lambda list} {
    foreach elem $list {
        lappend result [apply $lambda $elem]
    }
    return $result
}
 
proc sierpinski_triangle n {
    set down [list *]
    set space " "
    for {set i 1} {$i <= $n} {incr i} {
        set down [concat \
            [map [subst -nocommands {x {expr {"$space[set x]$space"}}}] $down] \
            [map {x {expr {"$x $x"}}} $down] \
        ]
        append space $space
    }
    return [join $down \n]
}
 
puts [sierpinski_triangle 4]