This problem was asked by jane street. Cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. Given this implementation of cons: def cons(a, b): def pair(f): return f(a, b) return pair implement car and cdr.
Answers
Answered by
0
In case of functional programming, the big issue while using with object oriented is that there are no proper name or symbol that explain the things which are going to work.
In short, if you have to define functional programming its all about to transfer the nature to function of course in code form to get final result.
Attachments:
Similar questions