From 2fc1ade4c9fc2b8146db4de8dd92deab0cbc564b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 7 Apr 2013 09:45:10 -0700 Subject: [PATCH] persistent.hashtables: fix missing keys/values, not sure why these aren't assocs. --- basis/persistent/hashtables/hashtables.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/persistent/hashtables/hashtables.factor b/basis/persistent/hashtables/hashtables.factor index 0159cab593..64577f8ff0 100644 --- a/basis/persistent/hashtables/hashtables.factor +++ b/basis/persistent/hashtables/hashtables.factor @@ -1,7 +1,7 @@ ! Based on Clojure's PersistentHashMap by Rich Hickey. USING: kernel math accessors assocs fry combinators parser -prettyprint.custom locals make +prettyprint.custom locals make sequences persistent.assocs persistent.hashtables.nodes persistent.hashtables.nodes.empty @@ -39,6 +39,10 @@ M: persistent-hash pluck-at M: persistent-hash >alist [ root>> >alist% ] { } make ; +M: persistent-hash keys >alist [ first ] map ; + +M: persistent-hash values >alist [ second ] map ; + :: >persistent-hash ( assoc -- phash ) T{ persistent-hash } assoc [| ph k v | v k ph new-at ] assoc-each ;