diff --git a/basis/shuffle/shuffle.factor b/basis/shuffle/shuffle.factor index 632c09e338..d375ec9c20 100644 --- a/basis/shuffle/shuffle.factor +++ b/basis/shuffle/shuffle.factor @@ -1,23 +1,22 @@ ! Copyright (C) 2007 Chris Double, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs effects.parser generalizations +USING: accessors assocs combinators effects.parser generalizations hashtables kernel locals locals.backend macros make math parser sequences ; IN: shuffle locals-assoc ( sequence -- assoc ) - dup length dup 1- [ - ] curry map zip >hashtable ; +: >index-assoc ( sequence -- assoc ) + dup length zip >hashtable ; PRIVATE> MACRO: shuffle-effect ( effect -- ) - [ out>> ] [ in>> >locals-assoc ] bi + [ out>> ] [ in>> >index-assoc ] bi [ - [ nip assoc-size , \ load-locals , ] - [ [ at , \ get-local , ] curry each ] - [ nip assoc-size , \ drop-locals , ] 2tri + [ nip assoc-size , \ narray , ] + [ [ at \ swap \ nth [ ] 3sequence ] curry map , \ cleave , ] 2bi ] [ ] make ; : shuffle(