# SICP Solutions

### Section - 2.5 - Systems with Generic Operations

#### Exercise 2.88

Following is the code for negation(complete code is presented at the bottom):

Examples:

Here goes the complete code:

Note: Here, I felt need to add int package also - which I have not yet added before this solution - drop was dropping everything to rationals which was my lowest droppable type and the output was not looking pretty. So, added int -> rational also into the existing hierarchy. I first tried to use integer? for tags like it was done for number/real package but it was causing issues because number? is true for both integer as well as real(atleast in the sicp package of DrRacket) - Even putting the check for integer first is not solving the problem as raise-to-type was going into infinite recursion when it tries to raise type of int to real. So, the only option left was to use tag - ‘int for integers. I also tried to use tag for ‘scheme-number(real) instead of just number? but it was making it difficult to write test functions - as i have to enter everythin using make-number or make-int - too much to type!