math.vectors: changes so that some vocabs that can use math.vector words does it
parent
001acde590
commit
61ba941740
|
@ -7,8 +7,6 @@ IN: checksums.hmac
|
|||
|
||||
<PRIVATE
|
||||
|
||||
: seq-bitxor ( seq seq -- seq ) [ bitxor ] 2map ;
|
||||
|
||||
: opad ( checksum-state -- seq ) block-size>> 0x5c <array> ;
|
||||
|
||||
: ipad ( checksum-state -- seq ) block-size>> 0x36 <array> ;
|
||||
|
@ -17,8 +15,8 @@ IN: checksums.hmac
|
|||
checksum-state block-size>> key length <
|
||||
[ key checksum checksum-bytes ] [ key ] if
|
||||
checksum-state block-size>> 0 pad-tail
|
||||
[ checksum-state opad seq-bitxor ]
|
||||
[ checksum-state ipad seq-bitxor ] bi ;
|
||||
[ checksum-state opad vbitxor ]
|
||||
[ checksum-state ipad vbitxor ] bi ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ render-loc render-dim ;
|
|||
ctline line-rect :> rect
|
||||
rect origin>> CGPoint>loc :> (loc)
|
||||
rect size>> CGSize>dim :> (dim)
|
||||
(loc) [ floor ] map :> loc
|
||||
(loc) (dim) [ + ceiling ] 2map :> ext
|
||||
(loc) vfloor :> loc
|
||||
(loc) (dim) v+ vceiling :> ext
|
||||
ext loc [ - >integer 1 max ] 2map :> dim
|
||||
|
||||
loc line render-loc<<
|
||||
|
|
|
@ -16,14 +16,11 @@ IN: benchmark.simd-1
|
|||
: normalize-points ( points -- )
|
||||
[ normalize ] map! drop ; inline
|
||||
|
||||
: max-points ( points -- point )
|
||||
[ ] [ vmax ] map-reduce ; inline
|
||||
|
||||
: print-point ( point -- )
|
||||
[ number>string ] { } map-as ", " join print ; inline
|
||||
|
||||
: simd-benchmark ( len -- )
|
||||
>fixnum make-points [ normalize-points ] [ max-points ] bi print-point ;
|
||||
>fixnum make-points [ normalize-points ] [ vsupremum ] bi print-point ;
|
||||
|
||||
: simd-1-benchmark ( -- )
|
||||
10 [ 500000 simd-benchmark ] times ;
|
||||
|
|
|
@ -39,7 +39,7 @@ M: color-preview model-changed
|
|||
[ <color-model> <color-preview> 1 track-add ]
|
||||
[
|
||||
[
|
||||
[ truncate ] map v>integer
|
||||
vtruncate v>integer
|
||||
first3 3dup "%d %d %d #%02x%02x%02x" sprintf
|
||||
] <arrow> <label-control>
|
||||
f track-add
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (c) 2012 Anonymous
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel math sequences ;
|
||||
USING: kernel math math.vectors sequences ;
|
||||
IN: rosetta-code.equilibrium-index
|
||||
|
||||
! http://rosettacode.org/wiki/Equilibrium_index
|
||||
|
@ -35,5 +35,5 @@ IN: rosetta-code.equilibrium-index
|
|||
[ <reversed> ] 2dip accum-left <reversed> ; inline
|
||||
|
||||
: equilibrium-indices ( seq -- inds )
|
||||
0 [ + ] [ accum-left ] [ accum-right ] 3bi [ = ] 2map
|
||||
0 [ + ] [ accum-left ] [ accum-right ] 3bi v=
|
||||
V{ } swap dup length iota [ [ suffix ] curry [ ] if ] 2each ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (c) 2012 Anonymous
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel math sequences ;
|
||||
USING: kernel math math.vectors sequences ;
|
||||
IN: rosetta-code.long-multiplication
|
||||
|
||||
! http://rosettacode.org/wiki/Long_multiplication
|
||||
|
@ -21,7 +21,7 @@ IN: rosetta-code.long-multiplication
|
|||
[ * ] cartesian-map
|
||||
dup length iota [ 0 <repetition> ] map
|
||||
[ prepend ] 2map
|
||||
[ ] [ [ 0 suffix ] dip [ + ] 2map ] map-reduce ;
|
||||
[ ] [ [ 0 suffix ] dip v+ ] map-reduce ;
|
||||
|
||||
: integer->digits ( x -- xs )
|
||||
{ } swap [ dup 0 > ] [ 10 /mod swap [ prefix ] dip ] while drop ;
|
||||
|
|
Loading…
Reference in New Issue