Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.45 KB | None | 0 0
  1. #|;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. HW4 #3
  3. Histogram.rkt  by Ryan Liszewski
  4. (a)Prints n asterisk(s) in a line
  5. (b)Prints a histogram using a recursive procedure and the line in (a)
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|#
  7. #lang racket
  8. (define (line n)
  9.   (cond ((< n 1) (newline))
  10.         (else (display "*") (line (- n 1)))))
  11.  
  12. (define (histogram list)
  13.   (if (null? list) (newline)
  14.       (begin (line (car list))
  15.              (histogram (cdr list)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement