PLQ #4Done on:   Tuesday, February 16th

Question 1 @ 2021-02-16 18:21

What would we get if we run the following expression in our FLANG evaluator:

{with {+ *} {call + 2 3}}

Question 2 @ 2021-02-16 18:26

Alice wants to map a curried version of the expt function onto a list of inputs. She first writes the function currify, which takes a two argument function and returns the curried version of the function.

(define (currify f)
  (lambda (x)
    (lambda (y)
      (f x y))))

She then writes a test using a curried expt function (Racket’s exponent):

(test (map (currify expt) ‘(2 3)) => 8)

What will be the result of this test?


Question 3 @ 2021-02-16 18:29

If we drop with from our FLANG language, would we get a weaker language?


Question 4 @ 2021-02-16 18:32

What is a good name for the following function?

(define mystery
  (lambda (f g)
    (lambda (x)
      (g (f x)))))