r coMp I r coMpa r co x 4 Heap e 2282 c Here ls l Egyptia l
r coMp I r coMpa r co x 4. Heap e 2282 c Here ls l Egyptia l In Jobs H l 3. Inser coMp: l E ENGR2 n course r Divide, Merges O users encs concordia ca-c348 2/notes/COMP348 assignment 2 FALL 2016.pdf Question#7: 120+6 Marks] 4 of 8 In this exercise assume: \"first- car\" and \"rest-cdr\" and L1 and L2 are two given lists. a Analyze this code and explain what myfunction3 is doing? (defun myfunction3 (L1 L2) (if (null L1) L2 (cons (first L1) (myfunction3 (rest L1) L2) b) Test this function on your computer by using some (at least 3) examples of different parameters for L1, and L2 and show your results Ask me anything a ENG 1041 PM US 2016-
Solution
Analysis for the following function:
(defun myfunction3 (L1 L2)->This function defines myfucntion3 with two arguments L1&L2
(if (null L1) ->check if L1 is null and if L1 is null it returns L2
L2
(cons (first L1) -> this cons function takes two arguments first and L1 and return new cons cell containing first and L1.
(myfunction3 (rest L1) L2) ->this rest function gives the remaining part of the L1.And then myfunction3 is called again using rest part of L1 and L2 again.
)
))
Basically it is a recursive function.
