Re: [xsl] RM: RFC: Instrinsically-defined maps?

Subject: Re: [xsl] RM: RFC: Instrinsically-defined maps?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 16 Apr 2014 06:53:53 -0700
A very quick comment, as I am leaving for work: this all seems
straight-forward using XSLT (XPath) 3.

In the case of arity > 1, we will use a map of maps (the inner maps
will represent partial application of the function.

The saxon:memo-function attribute has, I think, its standard
equivalent (at least a hint) in XSLT 3.0

Cheers,
Dimitre

On Wed, Apr 16, 2014 at 2:51 AM, David Rudel <fwqhgads@xxxxxxxxx> wrote:
> Consider Xpath functions, Xpath maps, and Saxon Memo-functions:
> A. maps and memo-functions allow caching.
> B. Xpath functions and memo-functions allow computing of outputs based
> on heretofore unseen inputs "on the fly" using intrinsic logic. They
> also allow arities other than 1.
> C. Xpath maps allow access to the keys of the hash.
>
> It would be nice to be able to have the features of all 3 in a single
> type.... in other words a memo-function whose stored keys you could
> retrieve.
>
> Unfortunately, there are two major barriers (in my mind, at least) to
> accomplishing the above:
>
> Saxon memo-functions are the closest thing to getting all 3, but XSLT
> functions are not first-class objects, so it isn't clear how you would
> direct the processor to operate on them. Also, it is not clear how the
> keys should be presented if the arity is greater than 1.
>
> For the case where arity = 1, the most natural solution would be to
> allow an intrinsic definition for the map that could be used whenever
> any of the extrinsic declarations are not applicable. Something like
>
> <xsl:variable name="default.function" as="function(xs:integer) as
> xs:integer" select="function($x){$x + 3}"/>
>
> <xsl:variable name="non.static.map" as="map(xs:integer,xs:integer)"
> select="map{2:= 4, 3:= 5, $default.function}"/>
>
> The idea would be that if $non.static.map were called with an
> xs:integer argument other than {2,3}, then it would return the value
> "input + 3" and store that input-output pair in its hash.
>
> Comments?
> -David
>
> --
>
> "A false conclusion, once arrived at and widely accepted is not
> dislodged easily, and the less it is understood, the more tenaciously
> it is held." - Cantor's Law of Preservation of Ignorance.
>



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread