]> gitweb.factorcode.org Git - factor.git/commitdiff
shuffle: Simpler definition imo.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 9 Jul 2015 21:45:41 +0000 (14:45 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 9 Jul 2015 21:45:41 +0000 (14:45 -0700)
basis/shuffle/shuffle.factor

index 769576bb039fb73e16a2ea2ef1f06fbad91600bf..0bab3c7a1bbc114b7e6c6d6a8de6fd3841d16035 100644 (file)
@@ -1,16 +1,15 @@
 ! Copyright (C) 2007 Chris Double, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators effects.parser
-generalizations sequences.generalizations hashtables kernel
-locals locals.backend macros make math parser sequences ;
+USING: accessors assocs combinators effects.parser fry
+generalizations kernel macros make sequences
+sequences.generalizations ;
 IN: shuffle
 
 MACRO: shuffle-effect ( effect -- )
-    [ out>> ] [ in>> H{ } zip-index-as ] bi
-    [
-        [ nip assoc-size , \ narray , ]
-        [ [ at \ swap \ nth [ ] 3sequence ] curry map , \ cleave , ] 2bi
-    ] [ ] make ;
+    [ in>> H{ } zip-index-as ] [ out>> ] bi
+    [ drop assoc-size '[ _ narray ] ]
+    [ [ of '[ _ swap nth ] ] with map ] 2bi
+    '[ @ _ cleave ] ;
 
 SYNTAX: shuffle(
     ")" parse-effect suffix! \ shuffle-effect suffix! ;