! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays generic hashtables kernel kernel.private
math namespaces parser sequences strings words libc fry
-alien.c-types alien.structs.fields cpu.architecture ;
+alien.c-types alien.structs.fields cpu.architecture math.order ;
IN: alien.structs
TUPLE: struct-type size align fields ;
[ first2 <field-spec> ] with with map ;
: compute-struct-align ( types -- n )
- [ c-type-align ] map supremum ;
+ [ c-type-align ] [ max ] map-reduce ;
: define-struct ( name vocab fields -- )
[
: define-union ( name members -- )
[ expand-constants ] map
- [ [ heap-size ] map supremum ] keep
+ [ [ heap-size ] [ max ] map-reduce ] keep
compute-struct-align f (define-struct) ;
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: namespaces sequences accessors math kernel
-compiler.tree ;
+compiler.tree math.order ;
IN: compiler.tree.normalization.introductions
SYMBOL: introductions
M: #branch count-introductions*
children>>
- [ count-introductions ] map supremum
+ [ count-introductions ] [ max ] map-reduce
introductions+ ;
M: #recursive count-introductions*
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: fry vectors sequences assocs math accessors kernel
+USING: fry vectors sequences assocs math math.order accessors kernel
combinators quotations namespaces grouping stack-checker.state
stack-checker.backend stack-checker.errors stack-checker.visitor
stack-checker.values stack-checker.recursive-state ;
: pad-with-bottom ( seq -- newseq )
dup empty? [
- dup [ length ] map supremum
+ dup [ length ] [ max ] map-reduce
'[ _ +bottom+ pad-head ] map
] unless ;
! See http://factorcode.org/license.txt for BSD license.
USING: tools.disassembler namespaces combinators
alien alien.syntax alien.c-types lexer parser kernel
-sequences layouts math math.parser system make fry arrays ;
+sequences layouts math math.order
+math.parser system make fry arrays ;
IN: tools.disassembler.udis
<<
: buf/len ( from to -- buf len ) [ drop <alien> ] [ swap - ] 2bi ;
: format-disassembly ( lines -- lines' )
- dup [ second length ] map supremum
+ dup [ second length ] [ max ] map-reduce
'[
[
[ first >hex cell 2 * CHAR: 0 pad-head % ": " % ]
! Copyright (c) 2007, 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
-USING: grouping math.parser sequences ;
+USING: grouping math.order math.parser sequences ;
IN: project-euler.008
! http://projecteuler.net/index.php?section=problems&id=8
PRIVATE>
: euler008 ( -- answer )
- source-008 5 clump [ string>digits product ] map supremum ;
+ source-008 5 clump [ string>digits product ] [ max ] map-reduce ;
! [ euler008 ] 100 ave-time
! 2 ms ave run time - 0.79 SD (100 trials)
! Copyright (c) 2007, 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
-USING: grouping kernel make sequences ;
+USING: grouping kernel make math.order sequences ;
IN: project-euler.011
! http://projecteuler.net/index.php?section=problems&id=11
: max-product ( matrix width -- n )
[ clump ] curry map concat
- [ product ] map supremum ; inline
+ [ product ] [ max ] map-reduce ; inline
PRIVATE>
: euler056 ( -- answer )
90 100 [a,b) dup cartesian-product
- [ first2 ^ number>digits sum ] map supremum ;
+ [ first2 ^ number>digits sum ] [ max ] map-reduce ;
! [ euler056 ] 100 ave-time
! 22 ms ave run time - 2.13 SD (100 trials)
! Copyright (C) 2008 Alex Chapman
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays kernel math sequences sequences.private shuffle ;
+USING: accessors arrays kernel math math.order
+sequences sequences.private shuffle ;
IN: sequences.modified
TUPLE: modified ;
TUPLE: summed < modified seqs ;
C: <summed> summed
-M: summed length seqs>> [ length ] map supremum ;
+M: summed length seqs>> [ length ] [ max ] map-reduce ;
<PRIVATE
: ?+ ( x/f y/f -- sum )
! Copyright (C) 2006, 2007, 2008 Alex Chapman
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel arrays namespaces sequences math math.vectors
-colors random ;
+USING: kernel arrays namespaces sequences math math.order
+math.vectors colors random ;
IN: tetris.tetromino
TUPLE: tetromino states colour ;
tetrominoes get random ;
: blocks-max ( blocks quot -- max )
- map [ 1+ ] map supremum ; inline
+ map [ 1+ ] [ max ] map-reduce ; inline
: blocks-width ( blocks -- width )
[ first ] blocks-max ;