Skip to content

Instantly share code, notes, and snippets.

@drsnyder
Created June 29, 2012 23:55
Show Gist options
  • Save drsnyder/3021495 to your computer and use it in GitHub Desktop.
Save drsnyder/3021495 to your computer and use it in GitHub Desktop.
ocn programming problem 5
; [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