[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: xpath2 functions returning ()

Subject: RE: Re: xpath2 functions returning ()
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 4 Jan 2002 13:35:03 -0800 (PST)
xpath2 haskell
> > A string is a list (sequence) of characters. The empty string
> > is an empty such
> > sequence. It is "no character" but it is still a string
> > (sequence) -- the empty
> > string (sequence).
> If you modeled a string as a sequence of characters, then to have a sequence
> of strings you would need to allow sequences of sequences; and then you
> would need to distinguish between an empty sequence and a sequence whose
> only member was an empty sequence. You can't get rid of the problem that
> easily!

Shouldn't be a problem, these two sequences are of different type, therefore
cannot/shouldn't be compared. No sense in comparing apples and eggs.

This is no problem in Haskell.

The type of the empty list:

MyExamples> :t []
[] :: [a]

that is, the type of the empty list is a list of any-typed values having all the
same type.

MyExamples> :t [[]]
[[]] :: [[a]]

The type of the list having a single element, which is the empty list is:
a list of lists, each of which is of (a single) any-type.

So the the type of the empty sequence is different from the type of the sequence of
sequences that has a single element (even if this single element happens to be the
empty sequence).

As can be seen from the above examples, the HUGS interpreter can automatically
determine the type of these expressions.

It seems to me that what was not the perfect decision was to allow a sequence to
have elements of different type. This is another (additional to using a single type
for sequence and set) unpleasant mix -- this time between lists and something like
tuples. In Haskell lists have undefined zero or positive number of elements of the
same type, while tuples have a pre-defined number of components each with its own
pre-defined type.

It is still unclear to me why the restriction was imposed that a sequence should not
have elements that are sequences. Take into account that every element-node that is
an element of a sequence actually represents a whole tree. Then the statement that a
sequence does not contain elements-sequences -- this statement does not seem to be
perfect -- a sequence can even contain elements that are trees.

Dimitre Novatchev.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.