Merge branch 'master' of git://factorcode.org/git/factor
commit
fa52490fe9
|
@ -48,7 +48,7 @@ HELP: output>sequence
|
|||
}
|
||||
} ;
|
||||
|
||||
HELP: reduce-output
|
||||
HELP: reduce-outputs
|
||||
{ $values
|
||||
{ "quot" quotation } { "operation" quotation }
|
||||
{ "newquot" quotation }
|
||||
|
@ -57,7 +57,7 @@ HELP: reduce-output
|
|||
{ $examples
|
||||
{ $example
|
||||
"USING: combinators.smart kernel math prettyprint ;"
|
||||
"3 [ [ 4 * ] [ 4 / ] [ 4 - ] tri ] [ * ] reduce-output ."
|
||||
"3 [ [ 4 * ] [ 4 / ] [ 4 - ] tri ] [ * ] reduce-outputs ."
|
||||
"-9"
|
||||
}
|
||||
} ;
|
||||
|
@ -84,7 +84,7 @@ ARTICLE: "combinators.smart" "Smart combinators"
|
|||
{ $subsection output>sequence }
|
||||
{ $subsection output>array }
|
||||
"Reducing the output of a quotation:"
|
||||
{ $subsection reduce-output }
|
||||
{ $subsection reduce-outputs }
|
||||
"Summing the output of a quotation:"
|
||||
{ $subsection sum-outputs } ;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ IN: combinators.smart.tests
|
|||
|
||||
|
||||
|
||||
[ 6 ] [ [ 1 2 3 ] [ + ] reduce-output ] unit-test
|
||||
[ 6 ] [ [ 1 2 3 ] [ + ] reduce-outputs ] unit-test
|
||||
|
||||
[ [ 1 2 3 ] [ + ] reduce-output ] must-infer
|
||||
[ [ 1 2 3 ] [ + ] reduce-outputs ] must-infer
|
||||
|
||||
[ 6 ] [ [ 1 2 3 ] sum-outputs ] unit-test
|
||||
|
|
|
@ -15,8 +15,8 @@ MACRO: input<sequence ( quot -- newquot )
|
|||
[ infer in>> ] keep
|
||||
'[ _ firstn @ ] ;
|
||||
|
||||
MACRO: reduce-output ( quot operation -- newquot )
|
||||
MACRO: reduce-outputs ( quot operation -- newquot )
|
||||
[ dup infer out>> 1 [-] ] dip n*quot compose ;
|
||||
|
||||
: sum-outputs ( quot -- n )
|
||||
[ + ] reduce-output ; inline
|
||||
[ + ] reduce-outputs ; inline
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors kernel arrays sequences math math.order
|
||||
math.partial-dispatch generic generic.standard generic.math
|
||||
classes.algebra classes.union sets quotations assocs combinators
|
||||
words namespaces continuations classes fry
|
||||
words namespaces continuations classes fry combinators.smart
|
||||
compiler.tree
|
||||
compiler.tree.builder
|
||||
compiler.tree.recursive
|
||||
|
@ -134,17 +134,19 @@ DEFER: (flat-length)
|
|||
over 2 <= [ drop ] [ 2/ 1+ * ] if 24 swap [-] 4 /i ;
|
||||
|
||||
: inlining-rank ( #call word -- n )
|
||||
[ classes-known? 2 0 ? ]
|
||||
[
|
||||
{
|
||||
[ body-length-bias ]
|
||||
[ "default" word-prop -4 0 ? ]
|
||||
[ "specializer" word-prop 1 0 ? ]
|
||||
[ method-body? 1 0 ? ]
|
||||
} cleave
|
||||
node-count-bias
|
||||
loop-nesting get 0 or 2 *
|
||||
] bi* + + + + + + ;
|
||||
[ classes-known? 2 0 ? ]
|
||||
[
|
||||
{
|
||||
[ body-length-bias ]
|
||||
[ "default" word-prop -4 0 ? ]
|
||||
[ "specializer" word-prop 1 0 ? ]
|
||||
[ method-body? 1 0 ? ]
|
||||
} cleave
|
||||
node-count-bias
|
||||
loop-nesting get 0 or 2 *
|
||||
] bi*
|
||||
] sum-outputs ;
|
||||
|
||||
: should-inline? ( #call word -- ? )
|
||||
dup "inline" word-prop [ 2drop t ] [ inlining-rank 5 >= ] if ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors alien.c-types alien.syntax combinators
|
||||
io.backend io.files io.files.info io.files.unix kernel math system unix
|
||||
unix.statfs.freebsd unix.statvfs.freebsd unix.getfsstat.freebsd
|
||||
sequences grouping alien.strings io.encodings.utf8
|
||||
sequences grouping alien.strings io.encodings.utf8 unix.types
|
||||
specialized-arrays.direct.uint arrays io.files.info.unix ;
|
||||
IN: io.files.info.unix.freebsd
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ io.backend io.encodings.utf8 io.files io.files.info io.streams.string
|
|||
io.files.unix kernel math.order namespaces sequences sorting
|
||||
system unix unix.statfs.linux unix.statvfs.linux io.files.links
|
||||
specialized-arrays.direct.uint arrays io.files.info.unix assocs
|
||||
io.pathnames ;
|
||||
io.pathnames unix.types ;
|
||||
IN: io.files.info.unix.linux
|
||||
|
||||
TUPLE: linux-file-system-info < unix-file-system-info
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax ;
|
||||
USING: alien.syntax unix.types ;
|
||||
IN: unix.statfs.freebsd
|
||||
|
||||
CONSTANT: MFSNAMELEN 16 ! length of type name including null */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax ;
|
||||
USING: alien.syntax unix.types ;
|
||||
IN: unix.statfs.linux
|
||||
|
||||
C-STRUCT: statfs64
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types io.encodings.utf8 io.encodings.string
|
||||
kernel sequences unix.stat accessors unix combinators math
|
||||
grouping system alien.strings math.bitwise alien.syntax ;
|
||||
grouping system alien.strings math.bitwise alien.syntax
|
||||
unix.types ;
|
||||
IN: unix.statfs.macosx
|
||||
|
||||
CONSTANT: MNT_RDONLY HEX: 00000001
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax ;
|
||||
USING: alien.syntax unix.types ;
|
||||
IN: unix.statfs.openbsd
|
||||
|
||||
CONSTANT: MFSNAMELEN 16
|
||||
|
|
Loading…
Reference in New Issue