]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/hashtables/hashtables.factor
factor: trim using lists
[factor.git] / extra / benchmark / hashtables / hashtables.factor
index abf821f2fcf2186bb0d4fc04e34717b50b64d497..b29cb3d43d3e8a9686b623842a64bd8c23d0904f 100644 (file)
@@ -1,13 +1,11 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators kernel locals math
-math.ranges memoize sequences strings hashtables
-math.parser grouping ;
-FROM: assocs => change-at ;
+USING: accessors assocs combinators grouping kernel math
+math.parser ranges sequences ;
 IN: benchmark.hashtables
 
 MEMO: strings ( -- str )
-    1 100 [a,b] 1 [ + ] accumulate nip [ number>string ] map ;
+    100 [0..b) 1 [ + ] accumulate* [ number>string ] map ;
 
 :: add-delete-mix ( hash keys -- )
     keys [| k |
@@ -33,7 +31,7 @@ MEMO: strings ( -- str )
     ] map drop
 
     keys [
-        hash [ 1 + ] change-at
+        hash [ 1 + ] assocs:change-at
     ] each ;
 
 : string-mix ( hash -- )