D
Daniel Pitts
Is that truly pseudo code, or will it run through a lisp interpreter?in pseudo code:
(define (-- n) (- n 1))
(define (n-times fun n)
(if (not (zero? n))
(begin
(fun n)
(n-times fun (-- n)))))
(define (display-row biggest-row n port)
(n-times (lambda (n) (display " " port)) (ceiling (/ (- biggest-
row n) 2)))
(n-times (lambda (n) (display "*" port)) n)
(newline))
(define (display-pyramid rows port)
(define (rec-disp-py rows n port)
(cond
((zero? n) (display-row rows 1 port))
((> n 0)
(display-row rows n port)
(rec-disp-py rows (- n 2) port)
)))
(rec-disp-py rows rows port))
(define (pyramid)
(display-pyramid 6 (current-output-port)))