Re: Ann: SWI-Prolog 7.1.0
Alan Baljeu <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
>> It's not always easy to avoid using defaulty data structures. But the >> benefits in both code clarity and performance can be quite >> significant :-) Specially when the defaulty bits are where the >> application spends most of its time. > > All true. Just, Prolog systems can also nicely generate a switch-on-tag > from code such as > > do(X) :- atom(X), .... > do(X) :- number(X), ... > do(X) :- string(X), ... > > etc. Properly implemented, the above should be faster than code like this > > do(atom(X)) :- > do(number(X)) :- > do(string(X)) :- Implementing this kind of optimization would be great, but my experience suggests the discriminator is not usually a basic data type. Thus tagging remains key.