On Thu, Feb 9, 2017 at 6:13 PM, Christopher Howard <[email protected] > wrote:
> Hi, I was just trying to understand... > > : (box? (box (4 5 6))) > -> $384375304 > : (box? $384375304) > -> NIL > : (car $384375304) > -> 4 > > Shouldn't (box? $384375304) be non-NIL? > As Danilo said box? evaluates its arguments and that's the reason to return NIL because a list is not an anonymous symbol The same happens with the call to car, car evaluates its arguments so you get the car of the list To allow box? to deal with anonymous symbol you must quote it If you type the $-number representing the anonymous symbol in the pil prompt you see its value, in your case: : $384375304 -> (4 5 6) The result of evaluating the anonymous symbols and that explains the behaviour of your calls to both box? and car, : (car $384375304) # = (car (4 5 6)) -> 4 but what if you call car with real anonymous symbol (quoting it to prevent evaluation)? : (car '$384375304) -> (4 5 6) why? my guess is anonymous symbols store its value in the car of its cell
