eq eql at work...
Posted: Mon Oct 15, 2012 7:39 am
HI
I have a query about that functions..
for ex. if I build a list:
(setf x ' (a b c))
and after I set : (setf y x)
now x and y are two different pointers to the same object in memory (like in Python's behavior...), is it?
infact : (eq x y) -> TRUE like (eql x y) t...(ps I know that two objects are eq if they are actually the same object in memory with same value;
but if i use push. : (push 'd x), only x changes not y!...then I can suppose that it's not a change_in_place...but a new list is create!!..right??
But if after use pop : (pop x) -> x returns now to have the same value of y but I suppose that now they are different object in memory, because also pop create a new list:
but if now i try to compare the two list : (eq x y) I would expect NIL but T happens...then NOW I'm confusing about eq & eql...
sorry for my bad english and thanks in advance for help !!!
I have a query about that functions..
for ex. if I build a list:
(setf x ' (a b c))
and after I set : (setf y x)
now x and y are two different pointers to the same object in memory (like in Python's behavior...), is it?
infact : (eq x y) -> TRUE like (eql x y) t...(ps I know that two objects are eq if they are actually the same object in memory with same value;
but if i use push. : (push 'd x), only x changes not y!...then I can suppose that it's not a change_in_place...but a new list is create!!..right??
But if after use pop : (pop x) -> x returns now to have the same value of y but I suppose that now they are different object in memory, because also pop create a new list:
Code: Select all
(let ((x (car 1st)))
(setf 1st (cdr 1st))
x)
sorry for my bad english and thanks in advance for help !!!