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 )
|
||||
dup length [ dup 1 > ]
|
||||
[ [ random ] [ 1- ] bi [ pick exchange ] keep ]
|
||||
[ [ iota random ] [ 1- ] bi [ pick exchange ] keep ]
|
||||
while drop ;
|
||||
|
||||
: delete-random ( seq -- elt )
|
||||
|
|
|
@ -9,7 +9,7 @@ CONSTANT: crc32-polynomial HEX: edb88320
|
|||
|
||||
CONSTANT: crc32-table V{ }
|
||||
|
||||
256 [
|
||||
256 iota [
|
||||
8 [
|
||||
[ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless
|
||||
] times >bignum
|
||||
|
|
|
@ -331,7 +331,7 @@ GENERIC: tuple-hashcode ( n tuple -- x )
|
|||
|
||||
M: tuple tuple-hashcode
|
||||
[
|
||||
[ class hashcode ] [ tuple-size ] [ ] tri
|
||||
[ class hashcode ] [ tuple-size iota ] [ ] tri
|
||||
[ rot ] dip [
|
||||
swapd array-nth hashcode* sequence-hashcode-step
|
||||
] 2curry each
|
||||
|
|
|
@ -139,7 +139,7 @@ M: hashtable set-at ( value key hash -- )
|
|||
PRIVATE>
|
||||
|
||||
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
|
||||
|
|
|
@ -556,7 +556,7 @@ PRIVATE>
|
|||
[ empty? not ] filter ;
|
||||
|
||||
: mismatch ( seq1 seq2 -- i )
|
||||
[ min-length ] 2keep
|
||||
[ min-length iota ] 2keep
|
||||
[ 2nth-unsafe = not ] 2curry
|
||||
find drop ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue