Re: some new info/issues on lists

On Wed, 22 Apr 2009 15:27:59 -0400
Sandro Hawke <sandro@w3.org> wrote:

> 
> 1.  We decided to have a "contains" predicate to check for whether some
>     value is in a list.  But it turns out the function name "contains"
>     is already used for searching for one string inside another.

Yeah, that's what I thought.

>  I suggest "in", but would be okay with "list-contains" or
>     "contains-item".

I would call it member, as it is usually called in Prolog.

> 
> 2.  We got rid of deep-equal because you can just check for list
>     identity.  But it seems to me there will often be lists of data
>     values, and data values generally need to be compared with the
>     appropriate equality predicate for their type (numeric-equal,
>     datetime-equal, duration-equal, XMLLiteral-equal,
>     compare+numeric-equal 0, text-compare+numeric-equal 0, etc).  I
>     suggest bringing back deep-equal for when you want comparison on
>     data values to be done using datatype equality instead of identity.
>     (This does suggest having a literal-equal or data-value-equal
>     predicate; literal-equal(x,y) is the same as deep-equal(list(x),
>     list(y))).

Data type constants that are equal will compare as equal. That is, 
List(1.0 2.0) = List(1.00 2.00).

We don't have identity, by the way. Identity is not logically definable.


> Oh, hmmm.  Now I realize I'm confused and worried about using rif:iri
> (or rif:local) with builtins.
> 
> Does:
>          ex:foo = 1
> ential:
>          external(numeric-equal(ex:foo, 1))
> ?

Yes. ex:foo is indistinguishable from 1 after you equated them.

michael

> Or is that a syntax error?  This comes up when we think about index-of
> with a list of 'objects' (eg rif:iris); we need to have a way to compare
> to the things in the list.
> 
>       -- Sandro

Received on Thursday, 23 April 2009 06:07:14 UTC