over transactions>> push ;
: total ( transactions -- balance )
- 0 [ amount>> + ] reduce ;
+ [ amount>> ] map-sum ;
: balance>> ( account -- balance ) transactions>> total ;
[ drop run-meeting-place ]
[ nip [ [ count>> number>string write bl ] [ self-count>> number>text write nl ] bi ] each ]
- [ nip 0 [ count>> + ] reduce bl number>chameneos-string print ]
+ [ nip [ count>> ] map-sum bl number>chameneos-string print ]
} 2cleave ;
! 6000000 for shootout, too slow right now
IN: benchmark.msgpack
: pack-sum ( seq -- n )
- 0 [ >msgpack msgpack> + ] reduce ;
+ [ >msgpack msgpack> ] map-sum ;
: pack-sum-lengths ( seq -- n )
- 0 [ >msgpack msgpack> length + ] reduce ;
+ [ >msgpack msgpack> length ] map-sum ;
: msgpack-benchmark ( -- )
500,000 iota pack-sum 124,999,750,000 assert=