On Fri, Nov 23, 2012 at 02:19:10PM -0800, Kon Lovett wrote: > On Nov 23, 2012, at 1:58 PM, Kevin Wortman <[email protected]> wrote: > > Hi, > > > > This may or may not be helpful, but I'll add that, if it were me, I'd > > represent an IP address as a list of four fixnums rather than a u8vector. > > Then the default hash function will work out of the box, and many of your > > functions can be written more concisely. E.g. > > > > (define IPv4-addr= equal?) > > > > (define (IPv4-address->string a) > > (string-intersperse (map number->string a) ".")) > > > > It's true that a u8vector will be a bit more space-efficient, but IMO it's > > wise to refrain from that level of optimization unless and until it's the > > only way to deal with an observed bottleneck. > > Normally I wouldn't disagree with the basic idea here, although I would > advocate a vector rather than list. > > However the existing srfi-69 implementation doesn't follow a pair's > references.
I'm not sure I understand correctly what you mean, but there's a difference between eq?-hash and eqv?-hash versus equal?-hash: the latter descends into lists recursively while the former two just look at the pair directly. This is expected behavior, if you think it doesn't do this please provide an example where it goes wrong and file a bugreport. > (Also I think there is a bug where "list?" beats "pair?" in the type > discrimination.) Example + bugreport would be much appreciated here too. > But vectors (structures are treated as vectors) and vector-like objects do > recurse into the contents, at least for 4 levels. Same goes for lists. I don't know why you think 4 levels are treated specially, AFAIK they recur to any level. Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
