1 ! Copyright (C) 2011 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: arrays assocs kernel math.ranges random sequences sets
9 : initial-alist ( n -- alist )
10 <iota> >array randomize dup zip ;
12 : change-random ( newkeys splay keys -- splay' )
13 swapd [ first pick delete-at first2 pick set-at ] 2each ;
15 : splay-benchmark ( -- )
16 100,000 initial-alist 10,000 cut
17 [ >splay ] [ randomize 10,000 head ] bi
18 change-random keys dup natural-sort assert= ;