GATEverse
← GATE CSE 1987

Q6a

MCQMarks unknown

A list of nn elements is commonly written as a sequence of nn elements enclosed in a pair of square brackets. For example. [10,20,30][10, 20, 30] is a list of three elements and [][] is a nil list. Five functions are defined below: car(l)car (l) returns the first element of its argument list ll; cdr(l)cdr (l) returns the list obtained by removing the first element of the argument list ll; glue(a,l)glue (a, l) returns a list mm such that car(m)=acar (m)= a and cdr(m)=lcdr (m)=l. f(x,y)≡f (x, y) \equiv if x=[]x= [] then yy else glue(car(x),f(cdr(x),y))glue (car (x), f (cdr (x), y)); g(x)≡g(x) \equiv if x=[]x = [] then [][ ] else f(g(cdr(x))f (g (cdr (x)), glue(car(x),[]))glue (car (x), [ ])) What do the following compute?

Sign in to save attempts.

Loading…