<?xml version='1.0' encoding='iso-8859-1'?><?xml-stylesheet type='text/xsl' href='http://w3future.com/w3f/w3f.xsl' ?>
<html xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xf="http://www.w3.org/2002/xforms/cr" xml:lang="en" xml:base="http://w3future.com/weblog/2003/05/21.xml">
<head>
<title>Wednesday, May 21, 2003 - Sjoerd Visscher's weblog</title>
<link rel="meta" type="application/rdf+xml" title="FOAF" href="http://w3future.com/people/sjoerd_visscher/foaf.rdf" />
</head>
<body>
<section id="content">
	<h>Sjoerd Visscher's weblog</h>
	<p>Pondering those web technologies that may change the future of the world wide web.</p>
	<section id="note">
		<h>Last Update</h>
		<p>10/16/2005; 1:27:32 AM</p>
		<p id="alternates" class="buttons">
			<l href="http://w3future.com/weblog/2003/05/21.xml?notransform" rel="alternate" type="application/xml" title="See this web page with XHTML 2.0 technology."><span>Try</span> XHTML 2.0</l>
			<l href="view-source:http://w3future.com/weblog/2003/05/21.xml?notransform" title="View the XHTML 2.0 source of this page."><span>Src</span> XHTML 2.0</l>
			<l href="http://w3future.com/tools/xr.pl?xr=http://w3future.com/xr/w3f.xml&amp;xml=http://w3future.com/weblog/2003/05/21.xml%3Fnotransform" rel="meta" type="application/rdf+xml" title="RDF metadata"><span>RDF</span> Metadata</l>
		</p>
		<xi:include href="http://w3future.com/w3f/buttons.xml" />
	</section><section>
  <h><a rel='prev' href='http://w3future.com/weblog/2003/05/20.xml#a200' title='Tuesday, May 20, 2003'>&lt;&#160;</a><a href="http://w3future.com/weblog/2003/05/21.xml">Wednesday, May 21, 2003</a><a rel='next' href='http://w3future.com/weblog/2003/05/22.txt#a202' title='Thursday, May 22, 2003'>&#160;&gt;</a></h>
<a name="a230"></a>
<section id="a230">
<h id='xpath20Sequences'><a href="http://w3future.com/weblog/2003/05/21.xml#a230" class="weblogItemTitle">XPath 2.0 sequences</a></h>
<p>One of the new features of <a href="http://www.w3.org/TR/xslt20/">XSLT 2.0</a> are the new <a href="http://www.w3.org/TR/xpath-datamodel/#sequences">sequences in the data model</a>. A sequence is &#8220;an ordered collection of zero or more items&#8221;. So no surprise here, just like arrays or lists in any other programming language. But sequences are special:</p>
<ul>
<li>Sequences are &#8220;flat&#8221;, they may not contain other sequences.</li>
<li>An item is equivalent to a singleton sequence containing that item and vice versa.</li>
</ul>
<p>To a programmer, this may seem very weird. But to a non-programmer this is obvious. F.e. a sequence of one can of beer is equivalent to one can of beer. And a sequence of 2 times a sequence of 3 cans of beer is only recognizable as a sequence of 6 cans of beer. So this is a beautiful and very natural abstraction.</p>
<p>Yet I don't know any other language that has something like it. I've been thinking about implementing it in <a href="http://w3future.com/html/loell/">Loell</a>, using the following syntax:</p>
<pre>x    = 1            // a sequence of one item
seq1 = 1, 2
seq2 = 0, seq1, 3   // 0, 1, 2, 3
seq3 = seq1, seq2   // 1, 2, 0, 1, 2, 3
 
// lists will still be there
lst1 = [0, seq1]    // [0, 1, 2]
</pre>
</section>
</section>
<xi:include href='http://w3future.com/tools/rdf.php?about=http://w3future.com/weblog/2003/05/21.xml' /></section>
<section id="navigation"><xi:include href="http://w3future.com/w3f/sections.xml" /></section>
<section id="sidebar"><xi:include href="http://w3future.com/weblog/sidebars/weblog.opml" /></section>
</body>
</html>

