chickadee » integer-map » fxmapping-split

fxmapping-split fxmap kprocedure

Returns two fxmappings. The first contains all of the associations of fxmap whose keys are less than or equal to k, and the second contains the remaining associations. This is equivalent to

(values (fxsubmapping<= fxmap k) (fxsubmapping> fxmap k))

but is implemented more efficiently.

If fxmap is empty, then both of the fxmappings returned by fxmapping-split are empty.


(let-values ((fxmaps (fxmapping-split (fxmapping 0 'a 1 'b 2 'c 3 'd) 2)))
  (map fxmapping->alist fxmaps))
 ⇒ (((0 . a) (1 . b) (2 . c))
((3 . d)))