Glad I could help!

I just found this in the Saxon documentation (I am adding it for the sake of completeness, even though you may be interested in BaseX):

saxon:memo-function

On Sun, Apr 5, 2020 at 10:34 AM Mickael Desfrenes <mickael.desfrenes@unicaen.fr> wrote:
That's great, just what I was looking for. And the rest of the presentation is interesting too.

Thank you !


De: "Andreas Mixich" <mixich.andreas@gmail.com>
Cc: "basex-talk" <basex-talk@mailman.uni-konstanz.de>
Envoyé: Samedi 4 Avril 2020 02:55:45
Objet: Re: [basex-talk] Memoize

Not sure, whether this went through to the mailing list or only to Mickael, so please, forgive me, if posting twice.
On Mon, Mar 23, 2020 at 11:05 AM Mickael Desfrenes <mickael.desfrenes@unicaen.fr> wrote:
Is there any known solution for function memoization in basex ? Or maybe a cache implementation ?

Not sure how much this helps, but there was a Balisage talk by James Fuller, titled "A catalog of Functional Programming idioms in XQuery 3.1", which produces (amongst others) a memoize function. It is written in the Marklogic dialect of XQuery. but porting it was a no-brainer, since, AFAIR, only the syntax for maps had to be changed. The Github repo is here.  
 
--
Minden jót, all the best, Alles Gute,
Andreas Mixich





--
Minden jót, all the best, Alles Gute,
Andreas Mixich