Norman Mutunga
Dhvanil Patel
December 3, 2014

Overview : This is a simple calculator in post-fix run in GUI.

Simple Racket Calc.

Concepts Demonstrated

  • We have used car and cdr to parse through a string in a stack .
  • We also used cons to stitch up the car after evaluation into a string in the stack.
  • We also used let* a meta-circular interpreter which is transformed into a lambda.
  • GUI was used for the visual presentation of the calculator. Lambda was used extensively and in the simplified form λ (lambda ).
  • Require racket/include was used to help link the two modules .

External Technology and Libraries

This library helped in putting up a visual representation of the Simple Racket Calculator

Favorite Lines of Code

  • Norman Mutunga:

This helps figure out the operation that was keyed in with the numbers and in what order.

 [(op? (car expr)) ;; Figure out what type of operation it is + ,- ,/ ,* 
      (let* ([op (car expr)]
             [rhs (car stack)]
             [lhs (cadr stack)]
             [result ((op->procedure op) lhs rhs)]) ;; eval operation
        (eval-rpn (cdr expr) (cons result (cddr stack))))] ;; push result; pop lhs/rhs
  • Dhvanil Patel:
    Making top-row and adding that to mathcalculator frame and the second one creating a button and adding that to toprow panel

(define top-row ( instantiate horizontal-panel% ()

                   (parent mathcalculator )
                   (border 0 )
                   ( alignment '(left top )))) 

( instantiate button% ()

   (label "+")
   (min-width 50)
   (min-height 50)

   (callback ( lambda (button event)
                (send top-row show #t)
                (send display-window set-value "+")
                (display "  Procedure: + "))))

Technology Used Block Diagram