Question: The task is to create a lisp file, containing the definitions of two functions: applyRev and applyCombo (both functions described below) The descriptions of the

The task is to create a lisp file, containing the definitions
of two functions: applyRev and applyCombo (both functions described below)
 The task is to create a lisp file, containing the definitions

The descriptions of the two higher order functions are provided below. (applyRev FList V) FList must be a list of functions, V can be any lisp value ; applyRev applies the last function in Flist to y ; then the second to last function in Flist the result, then the third to last function to that sult, etc, returing the final result (returns V if FList is null) ; e.g. ; (applyRev '(- sqrt length) (2 4 6 8)) ; effectively returns the result of (- (sqrt (length '(2 4 6 8)))) ; the function should simply return nil in the event of an error (e.g. if Flist contains something that is not a function) (applyCombo F Flist vlist) ;F must be a function, ; Flist must be a list of functions, each of which expects a single parameter, Vlist must be a list of values, and Vlist and Flist must be of the same length ; applyCombo applies each element of Flist to the corresponding element of vlist, building a list of the results, then applying F to that list and returning ; the result ; e.g. ; (applyCombo '+ '(- sqrt length) '(5 36 (10 20 30))) ; effectively returns the result of (apply '+ (list (-5) (sqrt 36) (length (10 20 30 )))) ; the function should simply return nil in the event of an error ; (e.g. Flist and vlist are different sizes, F isn't a function, etc) The descriptions of the two higher order functions are provided below. (applyRev FList V) FList must be a list of functions, V can be any lisp value ; applyRev applies the last function in Flist to y ; then the second to last function in Flist the result, then the third to last function to that sult, etc, returing the final result (returns V if FList is null) ; e.g. ; (applyRev '(- sqrt length) (2 4 6 8)) ; effectively returns the result of (- (sqrt (length '(2 4 6 8)))) ; the function should simply return nil in the event of an error (e.g. if Flist contains something that is not a function) (applyCombo F Flist vlist) ;F must be a function, ; Flist must be a list of functions, each of which expects a single parameter, Vlist must be a list of values, and Vlist and Flist must be of the same length ; applyCombo applies each element of Flist to the corresponding element of vlist, building a list of the results, then applying F to that list and returning ; the result ; e.g. ; (applyCombo '+ '(- sqrt length) '(5 36 (10 20 30))) ; effectively returns the result of (apply '+ (list (-5) (sqrt 36) (length (10 20 30 )))) ; the function should simply return nil in the event of an error ; (e.g. Flist and vlist are different sizes, F isn't a function, etc)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!