add a few usages of iota, remove most 1+ and 1- from core

db4
Doug Coleman 2009-05-01 19:58:24 -05:00
parent ce7ad9a42d
commit 0ad6d1fb7b
27 changed files with 77 additions and 77 deletions

View File

@ -54,7 +54,7 @@ PRIVATE>
: randomize ( seq -- seq ) : randomize ( seq -- seq )
dup length [ dup 1 > ] dup length [ dup 1 > ]
[ [ random ] [ 1- ] bi [ pick exchange ] keep ] [ [ iota random ] [ 1- ] bi [ pick exchange ] keep ]
while drop ; while drop ;
: delete-random ( seq -- elt ) : delete-random ( seq -- elt )

View File

@ -9,7 +9,7 @@ CONSTANT: crc32-polynomial HEX: edb88320
CONSTANT: crc32-table V{ } CONSTANT: crc32-table V{ }
256 [ 256 iota [
8 [ 8 [
[ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless [ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless
] times >bignum ] times >bignum

View File

@ -331,7 +331,7 @@ GENERIC: tuple-hashcode ( n tuple -- x )
M: tuple tuple-hashcode M: tuple tuple-hashcode
[ [
[ class hashcode ] [ tuple-size ] [ ] tri [ class hashcode ] [ tuple-size iota ] [ ] tri
[ rot ] dip [ [ rot ] dip [
swapd array-nth hashcode* sequence-hashcode-step swapd array-nth hashcode* sequence-hashcode-step
] 2curry each ] 2curry each

View File

@ -139,7 +139,7 @@ M: hashtable set-at ( value key hash -- )
PRIVATE> PRIVATE>
M: hashtable >alist M: hashtable >alist
[ array>> [ length 2/ ] keep ] [ assoc-size <vector> ] bi [ [ array>> [ length 2/ iota ] keep ] [ assoc-size <vector> ] bi [
[ [
[ [
[ 1 fixnum-shift-fast ] dip [ 1 fixnum-shift-fast ] dip

View File

@ -556,7 +556,7 @@ PRIVATE>
[ empty? not ] filter ; [ empty? not ] filter ;
: mismatch ( seq1 seq2 -- i ) : mismatch ( seq1 seq2 -- i )
[ min-length ] 2keep [ min-length iota ] 2keep
[ 2nth-unsafe = not ] 2curry [ 2nth-unsafe = not ] 2curry
find drop ; inline find drop ; inline