From 4ee82b19f66a4b6ac27a946466cc3d68442c2bbf Mon Sep 17 00:00:00 2001
From: Joe Groff <arcata@gmail.com>
Date: Mon, 9 Feb 2009 17:47:55 -0600
Subject: [PATCH] rewrite shuffle( -- ) to avoid locals primitives

---
 basis/shuffle/shuffle.factor | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

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
 
 <PRIVATE
 
-: >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(