Created
June 29, 2012 23:55
-
-
Save drsnyder/3021495 to your computer and use it in GitHub Desktop.
ocn programming problem 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; [SPOILER=Iterative][CODE]#include <stdio.h> | |
(define (print-* n) | |
(if (= n 0) | |
(display "\n") | |
(and | |
(display "* ") | |
(print-* (- n 1))))) | |
(define (print-full-* n) | |
(and | |
(print-* 1) | |
(print-* n) | |
(print-* 1))) | |
(define (print-*-hist-r n p) | |
(cond ((= n 0) (print-* 0)) | |
((< p n) | |
(and (print-* p) | |
(if (> p 1) | |
(print-* 1) | |
#t) | |
(print-*-hist-r n (+ p 1)) | |
(if (> p 1) | |
(print-* 1) | |
#t) | |
(print-* p))) | |
(else (print-* p)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment