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" https://www.balisage.net/Proceedings/vol17/author-pkg/Fuller01/BalisageVol17-Fuller01.html, 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 https://github.com/xquery/xquery_functional_catalog/.