<PRIVATE
-: seq-bitxor ( seq seq -- seq ) [ bitxor ] 2map ;
-
: opad ( checksum-state -- seq ) block-size>> 0x5c <array> ;
: ipad ( checksum-state -- seq ) block-size>> 0x36 <array> ;
:: init-key ( checksum key checksum-state -- o i )
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 block-size>> 0 pad-tail
+ [ checksum-state opad vbitxor ]
+ [ checksum-state ipad vbitxor ] bi ;
PRIVATE>
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<<
: 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 ;
[ <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
! 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
[ <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 ;
! 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
[ * ] 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 ;