pascal's triangle

#!/usr/bin/racket
#lang racket


(define (factorial n)
  (define (iter product counter)
    (if (> counter n)
        product
        (iter (* counter product)
              (+ counter 1))))
  (iter 1 1))

;; where n is the row and k is the column
(define (entry n k)
   (/ (factorial n)
      (* (factorial k)
         (factorial (- n k)))))

(define (nspaces n s)
  (if (> n 0)
      (nspaces (- n 1) (string-append s " "))
      (display s)))

(define (display-pascal-row n)
  (define (column-iter i)
    (display " ")
    (if (odd? (entry n i))
        (display "*")
        (display " "))
    (if (= i n)
        (newline)
        (column-iter (+ i 1))))
  (column-iter 0))

(define (display-sierspinksi n)
  (define (display-pascal-iter i)
    (nspaces (- n i) " ")  (display-pascal-row i)
    (if (= i n)
        (newline)
        (display-pascal-iter (+ i 1))))
  (display-pascal-iter 0))

(display-sierspinksi 63)