Re: Ann: SWI-Prolog 7.1.0
Michael Hendricks <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFHuXubv_Y5DDzC60bCEACCchxV-bx-46sQ0ryBmfa4CpkWGdg@mail.gmail.com> |
On Dec 7, 2013 2:56 AM, "Jan Wielemaker" <[email protected]> wrote: > 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)) :- Is there an efficient term_tag(+Term, -Tag:atom) predicate so we can manually perform this optimization when wanted? do(X) :- term_tag(X, Tag), do_(Tag, X). do_(Tag, X) :- ... -- Michael -------------- next part -------------- HTML attachment scrubbed and removed