Expr expr var symbolin the above
(b) finish-time of ri is earlier than the finish time of rj;
(c) duration of ri is shorter than the duration of rj.
Step3: repeat the above step till there is no request to select.
1
For instance, for the following
(define requests
’((0 8) (8 11)
(1 3) (4 13) (5 6)
(3 10) (7 9) (10 12)))• The second request that does not overlap with the already selected requests is (8 11).• No more selection is possible.
(You can use the built-in sort function in Racket for this assignment.)
(define e1 ’x) ;; just a variable
(define e2 ’(lambda x x)) ;; identity function
( |
---|
You will write a function lsem in Racket, which takes as input a lambda expression, and β-reduces the expression repeatedly until it cannot be β-reduced any further. The input to your function will be always valid lambda expressions (as per the above grammar). You do not have to implement α-conversion and manage possible non-termination in β-reductions due to presence of self-replicating expressions.
The following presents expected results of your implemented functions.
#lang racket
(require "tests.rkt")
(provide (all-defined-out))In the above, the tests.rkt will be used as an input file for our test programs. For instance, it may contain the following tests.
• You are expected to test your code extensively. If your implementation fails any assessment test, then points will be deducted. Almost correct is equivalent to incorrect solution for which partial credits, if any, will depend only on the number of assessment tests it successfully passes.
• The focus is on correct implementation. In this assignment, we will not assess the efficiency; however, avoid re-computations and use tail-recursion, if possible.