Skip to content

Instantly share code, notes, and snippets.

xquery version "1.0-ml";
declare variable $deck-counter := map:map();
declare variable $deck := map:map();
declare function local:get-card($num) {
let $card := map:get($deck-counter, xs:string($num))
let $_ := xdmp:log(fn:concat("card: ", $card, " $num: ", $num), "debug")
return
(: call recursively with another rand number, if the
xquery version "1.0-ml";
declare variable $deck-counter := map:map();
declare variable $deck := map:map();
declare function local:get-card($num) {
let $card := map:get($deck-counter, xs:string($num))
return
if (fn:empty($card)) then
local:get-card(xdmp:random(52))