I noticed today that the is_dict and is_pair checks are not appearing to work properly. Here is an example that shows the issue:
[code]
#!/usr/bin/python
import pmt
def print_pmt(dictVar):
print 'isPair:%05s, isDict:%05s, isTuple:%05s => %s' % (pmt.is_pair(dictVar), pmt.is_dict(dictVar), pmt.is_tuple(dictVar), dictVar)
print 'DICT'
d = pmt.make_dict()
print_pmt(d)
d = pmt.dict_add(d, pmt.intern('a'), pmt.intern('b'))
print_pmt(d)
d = pmt.dict_add(d, pmt.intern('c'), pmt.intern('d'))
print_pmt(d)
d = pmt.dict_add(d, pmt.intern('e'), pmt.intern('f'))
print_pmt(d)
print '\nCONS'
p = pmt.cons(pmt.make_dict(), pmt.make_u8vector(0,0))
print_pmt(p)
[/code]
Run that and you'll see what I consider strange behavior. The values of is_pair and is_dict to not match what is expected. Is that by design? If so, why?
((a . b)) is not a pair... It's a single element dictionary
((c . d) (a . b)) i can sorta see this being a pair, but it wasn't created that way
((e . f) (c . d) (a . b)) definitely not a pair as it's 3 elements
(() . #[]) don't dictionaries have to be nested?
Thanks!