[SOLVED] CS scheme (define (multiplyBy x)

$25

File Name: CS_scheme_(define_(multiplyBy_x).zip
File Size: 301.44 KB

5/5 - (1 vote)

(define (multiplyBy x)
(lambda(y) (* x y)))

(define double (multiplyBy 2))
(define triple (multiplyBy 3))

(double 2) ;=> 4
(triple 5) ;=> 15

;(define triple (multiplyBy 3))
;(lambda(y) (* 3 y))

;(triple 5)
;(* 3 5)
;15

(((lambda(a) (lambda(b c)(if (> (- b c) a) pizza french fries))) 5) 11 5)

(define (boxcar h a b)
(lambda(x)(if (and (>= x a)(<= x b)) h 0)))(define box1 (boxcar 10 3 7))(box1 5);(#%require plot) ;borrowed from racket (not scheme);(plot (function box1 0 20));(plot (function (boxcar 25 5 10) 0 20))(define (foo f)(lambda(x)(lambda(y)(lambda(z)(f x y z)))))(foo +)((foo +) 1)(((foo +) 1) 2)((((foo +) 1) 2) 3)(define (bar x y z)(- (* x y)z))(foo bar)((((foo bar) 3)4)5)(define (func a)((lambda(b) (lambda(c d)(-(* b c)d))) (+ a 3)))(func 1)(define closure (func 1))(closure 2 3)((func 1) 2 3)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS scheme (define (multiplyBy x)
$25