W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > August 2007

Re: The p:pack step

From: Innovimax SARL <innovimax@gmail.com>
Date: Fri, 10 Aug 2007 08:54:31 +0200
Message-ID: <546c6c1c0708092354i56401aecqca681ecd63703c8c@mail.gmail.com>
To: "Alessandro Vernet" <avernet@orbeon.com>
Cc: public-xml-processing-model-wg <public-xml-processing-model-wg@w3.org>


First, thanks for the link

Going into detail of such a big list, we only lack few operations
today (see below for the detailed discussion)

Here they are

* the step p:is-empty to check whether a sequence is empty.
  I also propose as an alternative the possibility to add a <p:option
name="limit" value="-1"> to p:count such that the value computed by
p:count is unbounded (-1) or limited to the value of limit (I must
admit I prefer the latter)
---> Use case : many time we would only need to check whether a
sequence is 0, 1 or 2+ (so we would need to buffer only 2 documents to
have this information)

* add a <p:option name="stop-test-after-first-false" value="no"/>
which would if positioned to true behave like span/break
(takeWhile/dropWhile) // TODO : choose a better name
---> Use case : this one would be useful for processing interspersed
list (A,A, A, B, A, A, A, C, A, A, A, D) etc.

* and p:pack which I already proposed
---> Use case : compare sequence of documents

The other functions could be done with existing steps (essentially
p:viewport and p:split-sequence) and trough the use of recursion

Some are out of reach because of we do not have port="*" anymore. I
especially think of p:transpose which would need p:input port="*" AND
p:output port="*"


=== Details ===

If we look carefully at this one

We today have
* All the basic function (trough the use of p:split-sequence) except the isEmpty
* for the List transformation
  o map is done trough p:viewport
  o we effectively don't have reverse (but this couldn't be done
efficiently anyway)
  o intersperse can be done efficiently with p:viewport
  o and transpose would effectively replace the need for p:pack, but
p:transpose would be a p:input ="*"/p:output="*", which we do not have

* regarding folds, recursion is the solution (and the only one)

* for special folds
  o concat is done naturally by allowing multiple pipes in a p:input element
  o the other functions are numeric (and we don't need them since our
sequence contains document

[skipping some numerical operations and infinite things..]

* for sublists
  o take/drop/splitAt can be done very efficiently with p:split-sequence
  o takeWhile/dropWhile/span/break could be done with an extra option
on p:split-sequence

* group can be done with p:wrap

For the rest, we haven't provide so far functions for removing
duplicates/sorting and so on. I think that this choice make sense,
since such operations are really costly and could be done with

On 8/10/07, Alessandro Vernet <avernet@orbeon.com> wrote:
> On 8/9/07, Norman Walsh <ndw@nwalsh.com> wrote:
> > Mohamed asked to have p:pack on the agenda, but we didn't get to it.
> > I'd like to close as many issues as possible in email.
> >
> > Please indicate if you are in favor of adding this step or not.
> a) I haven't encountered the need for such a component in the
> pipelines I have written so far.
> b) There are number of basic operations on sequenced which we could
> implement with a component. See [1] for what Haskell has to offer. Our
> "pack" is similar to Haskell's "zip" (except zip drops items from the
> longest list). But there are a number of other components we could
> provide as well, and adding just pack at this point seems somewhat
> arbitrary to me.
> So I don't have a strong objection to adding "pack", but would rather
> leave it out for now, and add this to our virtual list of things to
> keep in mind for V.2.
> [1] http://haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> http://www.orbeon.com/

Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Friday, 10 August 2007 06:54:39 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:44 UTC