MUPL Programs Assignment

From CSE425S Wiki
Jump to navigation Jump to search

Warning icon.svg WARNING: Do NOT attempt until you have completed Parts 1, 2, and 3 of the MUPL Lab.

Motivation

Writing a curried, higher order function as your first MUPL program seems a bit steep. This studio is designed to be done after parts 1, 2, and 3 of the MUPL Lab, but before you attempt to write mupl-map.

Code to Implement

For your MUPL programs you should be constructing MUPL abstract syntax trees out of the MUPL structs provided by Prof. Grossman. The result of each program is a MUPL function comprised of MUPL expressions and the occasional string, int, and boolean constant (e.g. "fred", 42, #f) which the MUPL structs require.

NOTE: you should NOT use the closure struct as it is not a MUPL expression. It is a MUPL value.

mupl-double

; racket version for reference
(define (racket-double n) (+ n n))
; mupl-double return a mupl-function which doubles its mupl-int argument
(define mupl-double
  'not-yet-implemented)

mupl-sum-curry

; racket version for reference
(define (racket-sum-curry a) (lambda (b) (+ a b)))
; mupl-sum-curry return a mupl-function which returns a mupl-function which adds the two mupl-function's mupl-int arguments together
(define mupl-sum-curry
  'not-yet-implemented)

mupl-map-one

; racket version for reference
(define (racket-map-one proc) (proc 1))
; mupl-map-one: return a mupl-function that invoks the mupl-function passed in with the mupl-int argument 1
(define mupl-map-one
  'not-yet-implemented)