[xquery-talk] Functional XPath commands

Michael Sokolov msokolov at safaribooksonline.com
Sun Jan 26 08:16:28 PST 2014

If you're a big fan of implicit type casts, you might want to take a 
look at JavaScript.  This movie 
https://www.destroyallsoftware.com/talks/wat has some pretty funny 
examples (see, eg [] + [], [] + {}, {} + {}, etc. -- none of them ends 
up being what you might expect).


On 1/26/14 12:53 AM, Ihe Onwuka wrote:
> and it came to pass that the innocuous looking conditional in the  if
> statement demands that @firstpage is cast to xs:integer before it will
> work lest there be complaints of unTypedAtomic (or whatever it said)
> comparisons with xs:integer.
> What is the pourquoi of this. Why no type promotion (or is it
> downcasting) in effect here. What could be simpler than comparing to
> 0.
> Verily twas a tough spot, I went through every other conditional in
> the program first because it looked to me like the least likely
> suspect.
> On Fri, Jan 24, 2014 at 1:14 PM, Ihe Onwuka <ihe.onwuka at gmail.com> wrote:
>> So I have just written
>> if (@firstpage eq 0) then floor($totalPagesDecimal) else
>> ceiling($totalPagesDecimal)
>> but how close would
>> (floor,ceiling)[@firstpage + 1]($totalPagesDecimal) have been
>> I'm guessing  I would at least have to put some function invoking
>> paraphenalia around the calls to floor and ceiling (hopefully not).
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list