PLQ #4Done on:   Tuesday, February 6th

Question 1 @ 2024-02-06 19:14

Which kinds of functions do we have in our current version of the Flang language?


Question 2 @ 2024-02-06 19:17

We know that we can drop with from the Flang language, because we can replace any of its uses:

{with {x V} B}

with a combination of call+fun:

{call {fun {x} B} V}

Is this symmetric? That is, could we similarly drop the call+fun and manage with just with?


Question 3 @ 2024-02-06 19:20

What is the main problem with our current Flang language implementation?


Question 4 @ 2024-02-06 19:22

Bob wants to map a curried version of the expt function onto a list of inputs. He 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))))

He 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 5 @ 2024-02-06 19:27

What is a good name for the following function?

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