- From: Jirka Kosek <jirka@kosek.cz>
- Date: Fri, 15 Nov 2013 02:53:54 +0100
- To: Michael Sokolov <sokolov@falutin.net>
- CC: John Lumley <john@saxonica.com>, EXPath ML <public-expath@w3.org>
- Message-ID: <52857EB2.60500@kosek.cz>
On 14.11.2013 17:17, Michael Sokolov wrote:
> I'm sorry, I don't think I was clear. What I meant was
>
> |bin:pack-integer|(|$in|| as ||xs:integer|, |$size|| as ||xs:integer|)|
> as ||xs:base64Binary
>
> could be
>
> |
> |bin:pack-integer|(|$in|| as ||xs:integer|*, |$size|| as ||xs:integer|)|
> as ||xs:base64Binary|
>
> which would pack a sequence of integers, one after the other, into a binary
I see. We have tried to keep function simple, yet powerful enough if
combined together. Do you have any real use-case where long sequences of
integers have to be packed at once?
> I guess without that we would do something like
>
> bin:join (for $i in $ints return bin:pack-integer($i, 4))
>
> which is fine. I was just wondering if we were making it harder to
> optimize, and also wondering if there might be some XQuery 3.0 function
> mapping way of doing this that I haven't learned yet :)
In XPath 3.0 you can use map operator
(http://www.w3.org/TR/xpath-30/#id-map-operator):
bin:join ($ints ! bin:pack-integer(., 4))
Jirka
--
------------------------------------------------------------------
Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
------------------------------------------------------------------
Professional XML consulting and training services
DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
Bringing you XML Prague conference http://xmlprague.cz
------------------------------------------------------------------
Received on Friday, 15 November 2013 01:54:29 UTC