- From: Dimitre Novatchev <dnovatchev@gmail.com>
- Date: Wed, 14 Jan 2026 06:58:30 -0800
- To: Christian Grün <cg@basex.org>
- Cc: Norm Tovey-Walsh <norm@saxonica.com>, "public-xslt-40@w3.org" <public-xslt-40@w3.org>
- Message-ID: <CAK4KnZd_gvomws44-zUQnb+Nb0U2pLOaudPkjrkBPmzUDuTMXg@mail.gmail.com>
Hi Christian, The N-way merge is used when the N sorted lists are so big/long that they cannot fit individually or together in the RAM of the computer. In this case the N generators will be created using the *gn:make-generator* function passing to it a provider that feeds it with one value at a time. And in fact, any of the N different data sources can be of different type (XML, JSON, etc) and have its own, unique data provider - all this is configurable. So, yes - if all the data is small and can fit into the RAM of the computer, there is no reason why we would want to use the N-way merging. The power of Generators is dealing with streaming data of unbounded volume. This is why N-way merge is used as an essential part of external sorting. > I guess it may be simple (and more persuasive) to reformulate it in a way that it works with infinite input? I tried for a while, but I failed. Please, read about the *gn:make-generator <https://qt4cg.org/pr/2247/xpath-functions-40/Overview.html#generator-make-generator>* function and its protocol with its data-provider. Also see the examples to it, and if there is something that is not clear, I would be glad to explain. I would be glad to answer any other questions you or the people around you might have. Thanks, Dimitre. On Wed, Jan 14, 2026 at 3:21 AM Christian Grün <cg@basex.org> wrote: > Hi Dimitre, > > > I really don't understand this statement. We have 138 examples/tests. > Today's proposal had 5-6 examples, at least half of which deal with > integers (even / odd/, etc. > > The proposal provides many examples, which are certainly helpful to > understand what the specific functions are supposed to do. What we still > miss (at least when I think of the feedback that I got from first reviewers > and possible future users) are examples that demonstrate that (and how) > generators will simplify tasks. An N-way merge could be a nice use case > indeed. The current example can also be answered without generators and > with a simple combination of join and sort: > > array:sort(array:join(($ar1, $ar2, $ar3))) > > I guess it may be simple (and more persuasive) to reformulate it in a way > that it works with infinite input? I tried for a while, but I failed. > > Best, > Christian > >
Received on Wednesday, 14 January 2026 14:58:45 UTC