> Is this a bug or is my understanding of how to use enum? from the
> documentation not correct.
>
> My mistake!
The correct syntax is (enum? *HT Val) and not (enum? '*HT Val).
I was quoting the tree name. Doh!
Regards,
Lindsay
Note: I am still not entirely clear why 'enum? can return unexpected (at
least to me) results in the sparse array case (see below)
Is it because 'enum precreates key nodes in the tree for a sparse array in
order to keep it balanced?.
e.g.
: (pp 'TestEnum)
(de TestEnum (N)
(off *HT)
(for I N
(let (Val (Hasher I))
(if (enum? *HT Val)
(prinl
"! Duplicate: "
I
"; "
Val
"; "
(sym (enum? '*HT Val))
"; "
(sym (val (enum '*HT Val))) )
(set (enum '*HT Val) I) ) ) ) )
-> TestEnum
: (TestEnum (** 2 16))
! Duplicate: 21487; 25853; NIL; NIL
! Duplicate: 42974; 51706; (NIL (NIL NIL NIL (NIL NIL NIL (NIL (NIL (NIL
(NIL (NIL (NIL NIL NIL (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
11011)))))))) NIL NIL NIL (NIL (NIL NIL NIL NIL NIL NIL NIL (NIL (NIL NIL
NIL NIL NIL NIL NIL NIL NIL (NIL NIL 28854)))))) NIL (NIL NIL NIL NIL NIL
NIL NIL NIL NIL (NIL (NIL (NIL NIL NIL (NIL NIL NIL NIL NIL NIL 3644))))));
NIL
! Duplicate: 50121; 260192; NIL; NIL
! Duplicate: 64461; 77559; NIL; NIL
-> 65536
>
>