Re: "dict"ionary typing?

Michael Hendricks <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFHuXuZRjLbSgJjod9eYDa-9EosJ_SqLU+NLpY+-3G+Rv=fnkA@mail.gmail.com>
On Dec 5, 2013 8:15 PM, "Richard A. O'Keefe" <[email protected]> wrote:
>
> On 5/12/2013, at 11:01 PM, Michael Hendricks wrote:
>
> >  One
> > might reasonably use append/3 as a function in three different modes.  I
> > haven't implemented it yet, but I'm considering a new feature for
> > library(func) inspired by Ciao's notation.  Specifically, a single ~
marks
> > the argument to be used as output for *this* call.
> >
> >  ?- writeln(append([a,b],[c,d],~)).
>
> It's just too bad that ~ is a perfectly good data term
> as it stands and append([a,b],[c,d],~) is also a perfectly
> good data term as it stands, so this query is perfectly
> meaningful right now, meaning something else.  This is a
> recipe for confusion.

I agree that the ambiguity will lead to some confusion.  Thinking of func
users, I estimate that the probable benefit minus the probable confusion
still leaves us with a large net gain in utility.  These estimates are
highly subjective and probably influenced by my own "ambiguity tolerance",
so the future may prove me wrong.

On a tangent, this comment somehow reminded me of some interesting research
in natural language:  Ambiguity can lead to greater communication
efficiency by relying on information already present in the context:
http://web.mit.edu/newsoffice/2012/ambiguity-in-language-0119.html

Their research reminds me of the confusion I faced when I first saw
append/3 or witnessed type inference in ML or learned about typeclasses in
Haskell.

> Oh yes, there is a >> logical << approach to functions in
> Prolog called "narrowing".  There's been quite a lot written
> about it.

Thank you for the reference. That's an area I haven't read about before.

-- 
Michael
-------------- next part --------------
HTML attachment scrubbed and removed
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.