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