Difference between revisions of "MUPL Programs Assignment"
Jump to navigation
Jump to search
(Created page with "Easing into writing MUPL map. =Code to Implement= ==mupl-double== <nowiki>; racket version for reference (define (racket-double n) (+ n n)) ; mupl-double return a mupl-funct...") |
|||
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]]. | |
+ | =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>. | ||
+ | |||
=Code to Implement= | =Code to Implement= | ||
+ | |||
==mupl-double== | ==mupl-double== | ||
Revision as of 05:07, 7 April 2020
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
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)