Difference between revisions of "MUPL Programs Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[File:Warning_icon.svg|100px]] '''WARNING''': Do '''NOT''' attempt until you have completed Parts 1, 2, and 3 of the [[MUPL_Assignment|MUPL Lab]].
+
[[File:Warning_icon.svg|100px]] '''WARNING''': Do '''NOT''' attempt until you have completed Parts 1, 2, and 3 of the [[MUPL_Assignment|UW MUPL Assignment]].
 
=Motivation=
 
=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_Assignment|MUPL Lab]], but before you attempt to write <code>mupl-map</code>.
 
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_Assignment|MUPL Lab]], but before you attempt to write <code>mupl-map</code>.

Latest revision as of 03:42, 15 November 2022

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

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)