Re: A Logical Model for Lists as Relations
Date: Thu, 11 May 2006 21:32:20 +0200
Message-ID: <44639138$0$31642$e4fe514c_at_news.xs4all.nl>
Marshall Spight wrote:
> ...Generalizing still further, we could accomodate > multidimensional lists as relations with multiple > index attributes.
Shouldn't we first cope with the basics?
> There are various selection operations we might want to do
> on lists. The full power of something like SQL's SELECT
> on a list, where the index was one of the attributes, would
> be useful. This would necessarily produce a relation result.
>
> There might be cases where one wanted a list result.
> For example, the substring operation. If one had a string
> "abcdefg" (actually { (0,a), (1,b) ... etc }) and wanted
> everything where the index was in [1..3], one would
> want { (0,b), (1,c), (2,d) } rather than { (1,b), (2,c), (3,d) }.
> Perhaps this could be accomplished with a library routine.
> (Otherwise you get into the territory of trying to make list
> a subtype of relation, and worse, wanting contravariant
> return types, ugh.)
If I understand correctly, Perl addresses
safety of contravariant return types
by being able to return different types depending
on return context.
Interestingly, Darren Duncan announced in
perl.perl6.language (nntp.perl.org) that he
is busy "in my spare time to implement a
Relation type for Perl 6".
[snip zip]
> What about imperative operations? This is a bit more complicated.
I suggest you only go into this if you suspect there is also something nice to be gained. Received on Thu May 11 2006 - 21:32:20 CEST