[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lisp Test



    Date: Sun, 22 Sep 85 21:15:09 EDT
    From: George J. Carrette <GJC@MIT-MC.ARPA>

    Here are some questions I'm thinking about putting into a lisp teasers
    test. In order so that I can get an idea of how difficult the questions
    are, please reply with your answers. Take no longer than 4 minutes.

    What are the return values of the following expressions when evaluated:
    [1] (let ((x (list nil))) (car x))
nil
    [2] (let ((x (list nil))) (setf (car x) 5) (car x))
5
    [3] (flet ((g () 5)) (g))
5
    [4] (flet ((g () 5)) (setf #'g #'(lambda () 7)) (g))
7
Except, it actually returns 5, and the global function (g) returns 7.
This has to be a bug.