Re: Ann: SWI-Prolog 7.1.0

Nicos Angelopoulos (Univ of York) <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <20131210184301.331d204a@ampelos>
Dear Jan, list,

On Sat, 7 Dec 2013 15:54:05 +0100
Jan Wielemaker <[email protected]> wrote:

> On 12/07/2013 02:48 PM, Michael Hendricks wrote:
> > 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) :-
> >     ...
> 
> Funny enough, this was also proposed by Nicos under the name
> term_type/2.  It might make sense, especially of a variable
> would leave the type unbound as well (just like term_hash/2).
> 
> Opinions?
> 
> 	Cheers --- Jan


	My point being  that now with the addition of strings we have a richer set,
        and that this is information that is cheap for the system to provide. 
	It will probably be hard to find a single definition to satisfy all.
	I suspect that it will be of limited usefulness, the application I have
	for them right now is in the context of a DSL.
        But where useful, they can be very handy. Not only you get efficiency, 
        but it also encourages more readable code. 
	My vote would be for the tightest type and a bound variable when arg(1) is variable. 
	Leaving Tag above unbound is counter intuitive (for my use case).

     
Thanks,

Nicos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.