Lookup ?
Posted: Fri Dec 01, 2006 8:50 am
Hi Lutz,
Why are these examples below not working? the lookup explanation says:
"Finds in assoc-list an association the key element of which has the same value as exp ........."
The (sym "10") returns also an Atom called 10, or is it an evaluation issue
in 'lookup..?
The confusing part is that they are all atoms.. but not symbols ofcourse,
so does 'lookup like symbols? or only atoms? If only atoms then it should
work with (sym "10")
(setq order '( 10 (0 1 2 11 20 19 18 9)))
(setq R (sym "10"))
> (symbol? (order 0 0))
nil
> (atom? (order 0 0))
true
> (symbol? (sym "10"))
true
> (atom? (sym "10"))
true
> (lookup (sym "10") order)
nil
> (lookup R order)
nil
> (lookup (first (list (sym "10"))) order)
nil
This is working, but officialy '10 is an invalid atom! ircc...
> (lookup '10 order)
(0 1 2 11 20 19 18 9)
These are the only one working..but for me just the same as the examples above..
> (lookup 10 order)
> (lookup (first (flat '((10)))) order)
(0 1 2 11 20 19 18 9)
Norman.
Why are these examples below not working? the lookup explanation says:
"Finds in assoc-list an association the key element of which has the same value as exp ........."
The (sym "10") returns also an Atom called 10, or is it an evaluation issue
in 'lookup..?
The confusing part is that they are all atoms.. but not symbols ofcourse,
so does 'lookup like symbols? or only atoms? If only atoms then it should
work with (sym "10")
(setq order '( 10 (0 1 2 11 20 19 18 9)))
(setq R (sym "10"))
> (symbol? (order 0 0))
nil
> (atom? (order 0 0))
true
> (symbol? (sym "10"))
true
> (atom? (sym "10"))
true
> (lookup (sym "10") order)
nil
> (lookup R order)
nil
> (lookup (first (list (sym "10"))) order)
nil
This is working, but officialy '10 is an invalid atom! ircc...
> (lookup '10 order)
(0 1 2 11 20 19 18 9)
These are the only one working..but for me just the same as the examples above..
> (lookup 10 order)
> (lookup (first (flat '((10)))) order)
(0 1 2 11 20 19 18 9)
Norman.