From f6a8b84d81021c63b35130155ff15176c265981f Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 18 Jul 2014 11:34:43 -0700 Subject: [PATCH] sorted-map-values --- minimart/sorted-map.rkt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/minimart/sorted-map.rkt b/minimart/sorted-map.rkt index b6a3b78..6ed0e9e 100644 --- a/minimart/sorted-map.rkt +++ b/minimart/sorted-map.rkt @@ -19,6 +19,7 @@ sorted-map-max sorted-map-delete sorted-map-keys + sorted-map-values ) (require "canonicalize.rkt") @@ -456,3 +457,10 @@ (match node [(T! l k v r) (walk l (set-add (walk r acc) k))] [(L _) acc]))) + +;; tonyg 20140718 Retrieve a list of the values of smap +(define (sorted-map-values smap) + (let walk ((node smap) (acc '())) + (match node + [(T! l k v r) (walk l (cons v (walk r acc)))] + [(L _) acc])))