add a few usages of iota, remove most 1+ and 1- from core
parent
ce7ad9a42d
commit
0ad6d1fb7b
|
@ -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 )
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue