(defn
least-greater-node
([x k level] (least-greater-node x k level nil))
([x k level update]
(if-not
(neg? level)
(let
[x
(loop
[x x]
(if-let
[x' (aget (.-forward x) level)]
(if (< (.-key x') k) (recur x') x)
x))]
(when-not (nil? update) (aset update level x))
(recur x k (dec level) update))
x)))