Chapter 2, Building Abstractions with Data

Section - 2.2 - Hierarchical Data and the Closure Property

Exercise 2.44


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#lang sicp

(#%require sicp-pict)

(define (up-split painter n)
   (if (= n 0)
      painter
      (let (
              (smaller (up-split 
                           painter (- n 1)
                       )
              )
           )
           (below 
                painter 
                (beside smaller smaller)
           )
      )
   )
)