factor: update for load-all
parent
3a430c4dae
commit
ee67a4d8d2
|
@ -71,10 +71,10 @@ M: pathname url-of
|
||||||
swap "\n" glue XML-CHUNK[[ <style><-></style> ]] ;
|
swap "\n" glue XML-CHUNK[[ <style><-></style> ]] ;
|
||||||
|
|
||||||
: help-meta ( -- xml )
|
: help-meta ( -- xml )
|
||||||
[XML <meta
|
XML-CHUNK[[ <meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width, initial-scale=1"
|
content="width=device-width, initial-scale=1"
|
||||||
/> XML] ;
|
/> ]] ;
|
||||||
|
|
||||||
: help-navbar ( -- xml )
|
: help-navbar ( -- xml )
|
||||||
"conventions" >link topic>filename
|
"conventions" >link topic>filename
|
||||||
|
@ -99,23 +99,23 @@ M: pathname url-of
|
||||||
dup '[ drop _ assoc-size 1 + bijective-base26 ] cache ;
|
dup '[ drop _ assoc-size 1 + bijective-base26 ] cache ;
|
||||||
|
|
||||||
: css-style ( style -- style' )
|
: css-style ( style -- style' )
|
||||||
R/ font-size: \d+pt;/ [
|
re"font-size: \d+pt;" [
|
||||||
"font-size: " ?head drop "pt;" ?tail drop
|
"font-size: " ?head drop "pt;" ?tail drop
|
||||||
string>number 2 -
|
string>number 2 -
|
||||||
"font-size: %dpt;" sprintf
|
"font-size: %dpt;" sprintf
|
||||||
] re-replace-with
|
] re-replace-with
|
||||||
|
|
||||||
R/ padding: \d+px;/ [
|
re"padding: \d+px;" [
|
||||||
"padding: " ?head drop "px;" ?tail drop
|
"padding: " ?head drop "px;" ?tail drop
|
||||||
string>number dup even? [ 2 * 1 + ] [ 2 * ] if
|
string>number dup even? [ 2 * 1 + ] [ 2 * ] if
|
||||||
number>string "padding: " "px;" surround
|
number>string "padding: " "px;" surround
|
||||||
] re-replace-with
|
] re-replace-with
|
||||||
|
|
||||||
R/ width: \d+px;/ [
|
re"width: \d+px;" [
|
||||||
drop ""
|
drop ""
|
||||||
] re-replace-with
|
] re-replace-with
|
||||||
|
|
||||||
R/ font-family: monospace;/ [
|
re"font-family: monospace;" [
|
||||||
" white-space: pre-wrap; line-height: 125%;" append
|
" white-space: pre-wrap; line-height: 125%;" append
|
||||||
] re-replace-with ;
|
] re-replace-with ;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ M: pathname url-of
|
||||||
[
|
[
|
||||||
[ print-topic ] with-html-writer css-styles-to-classes
|
[ print-topic ] with-html-writer css-styles-to-classes
|
||||||
[ help-stylesheet help-meta prepend help-navbar ] dip
|
[ help-stylesheet help-meta prepend help-navbar ] dip
|
||||||
[XML <div id="container"><-><div class="page"><-></div></div> XML]
|
XML-CHUNK[[ <div id="container"><-><div class="page"><-></div></div> ]]
|
||||||
] bi simple-page ;
|
] bi simple-page ;
|
||||||
|
|
||||||
: generate-help-file ( topic -- )
|
: generate-help-file ( topic -- )
|
||||||
|
|
|
@ -46,7 +46,7 @@ CHLOE: script
|
||||||
CHLOE: write-script
|
CHLOE: write-script
|
||||||
drop [
|
drop [
|
||||||
get-script
|
get-script
|
||||||
[XML <script type="text/javascript"> <-> </script> XML]
|
XML-CHUNK[[ <script type="text/javascript"> <-> </script> ]]
|
||||||
] [xml-code] ;
|
] [xml-code] ;
|
||||||
|
|
||||||
CHLOE: meta
|
CHLOE: meta
|
||||||
|
|
|
@ -82,7 +82,7 @@ SYMBOL: meta
|
||||||
|
|
||||||
: get-meta ( -- xml )
|
: get-meta ( -- xml )
|
||||||
meta get [
|
meta get [
|
||||||
[XML <meta name=<-> content=<->/> XML]
|
XML-CHUNK[[ <meta name=<-> content=<->/> ]]
|
||||||
] { } assoc>map ;
|
] { } assoc>map ;
|
||||||
|
|
||||||
: write-meta ( -- )
|
: write-meta ( -- )
|
||||||
|
|
|
@ -290,7 +290,7 @@ HELP: <anti-diagonal-matrix>
|
||||||
|
|
||||||
HELP: <identity-matrix>
|
HELP: <identity-matrix>
|
||||||
{ $values { "n" integer } { "matrix" matrix } }
|
{ $values { "n" integer } { "matrix" matrix } }
|
||||||
{ $description "Creates an " { $url URL" http://enwp.org/Identity_matrix" "identity matrix" } " of size " { $snippet "n x n" } ", where the diagonal values are all ones." }
|
{ $description "Creates an " { $url url"http://enwp.org/Identity_matrix" "identity matrix" } " of size " { $snippet "n x n" } ", where the diagonal values are all ones." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example
|
{ $example
|
||||||
"USING: math.matrices prettyprint ;"
|
"USING: math.matrices prettyprint ;"
|
||||||
|
@ -377,7 +377,7 @@ HELP: <cartesian-indices>
|
||||||
|
|
||||||
HELP: <cartesian-square-indices>
|
HELP: <cartesian-square-indices>
|
||||||
{ $values { "n" integer } { "matrix" square-matrix } }
|
{ $values { "n" integer } { "matrix" square-matrix } }
|
||||||
{ $description "Create a " { $link square-matrix } " full of " { $link cartesian-product } "s. See " { $url URL" https://en.wikipedia.org/wiki/Cartesian_product" "cartesian product" } "." }
|
{ $description "Create a " { $link square-matrix } " full of " { $link cartesian-product } "s. See " { $url url"https://en.wikipedia.org/wiki/Cartesian_product" "cartesian product" } "." }
|
||||||
{ $notes
|
{ $notes
|
||||||
{ $equiv-word-note "square" <cartesian-indices> }
|
{ $equiv-word-note "square" <cartesian-indices> }
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ HELP: <square-cols>
|
||||||
|
|
||||||
HELP: <lower-matrix>
|
HELP: <lower-matrix>
|
||||||
{ $values { "object" object } { "m" integer } { "n" integer } { "matrix" matrix } }
|
{ $values { "object" object } { "m" integer } { "n" integer } { "matrix" matrix } }
|
||||||
{ $description "Make a lower triangular matrix, where all the values above the main diagonal are " { $snippet "0" } ". " { $snippet "object" } " will be used as the value for the nonzero part of the matrix, while " { $snippet "m" } " and " { $snippet "n" } " are used as the dimensions. The inverse of this word is " { $link <upper-matrix> } ". See " { $url URL" https://en.wikipedia.org/wiki/Triangular_matrix" "triangular matrix" } "." }
|
{ $description "Make a lower triangular matrix, where all the values above the main diagonal are " { $snippet "0" } ". " { $snippet "object" } " will be used as the value for the nonzero part of the matrix, while " { $snippet "m" } " and " { $snippet "n" } " are used as the dimensions. The inverse of this word is " { $link <upper-matrix> } ". See " { $url url"https://en.wikipedia.org/wiki/Triangular_matrix" "triangular matrix" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example
|
{ $example
|
||||||
"USING: math.matrices prettyprint ;"
|
"USING: math.matrices prettyprint ;"
|
||||||
|
@ -451,7 +451,7 @@ HELP: <lower-matrix>
|
||||||
|
|
||||||
HELP: <upper-matrix>
|
HELP: <upper-matrix>
|
||||||
{ $values { "object" object } { "m" integer } { "n" integer } { "matrix" matrix } }
|
{ $values { "object" object } { "m" integer } { "n" integer } { "matrix" matrix } }
|
||||||
{ $description "Make an upper triangular matrix, where all the values below the main diagonal are " { $snippet "0" } ". " { $snippet "object" } " will be used as the value for the nonzero part of the matrix, while " { $snippet "m" } " and " { $snippet "n" } " are used as the dimensions. The inverse of this word is " { $link <lower-matrix> } ". See " { $url URL" https://en.wikipedia.org/wiki/Triangular_matrix" "triangular matrix" } "." }
|
{ $description "Make an upper triangular matrix, where all the values below the main diagonal are " { $snippet "0" } ". " { $snippet "object" } " will be used as the value for the nonzero part of the matrix, while " { $snippet "m" } " and " { $snippet "n" } " are used as the dimensions. The inverse of this word is " { $link <lower-matrix> } ". See " { $url url"https://en.wikipedia.org/wiki/Triangular_matrix" "triangular matrix" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example
|
{ $example
|
||||||
"USING: math.matrices prettyprint ;"
|
"USING: math.matrices prettyprint ;"
|
||||||
|
|
|
@ -125,7 +125,7 @@ ALIAS: transpose flip
|
||||||
|
|
||||||
: unshaped-cols-iota ( matrix -- cols-iota )
|
: unshaped-cols-iota ( matrix -- cols-iota )
|
||||||
[ first-unsafe length 1 ] keep
|
[ first-unsafe length 1 ] keep
|
||||||
[ length min ] (each) (each-integer) <iota> ; inline
|
[ length min ] (each) iterate-upto <iota> ; inline
|
||||||
|
|
||||||
: generic-anti-transpose-unsafe ( cols-iota matrix -- newmatrix )
|
: generic-anti-transpose-unsafe ( cols-iota matrix -- newmatrix )
|
||||||
[ <reversed> [ nth-end-unsafe ] with { } map-as ] curry { } map-as ; inline
|
[ <reversed> [ nth-end-unsafe ] with { } map-as ] curry { } map-as ; inline
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2009, 2010 Slava Pestov.
|
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays classes classes.tuple
|
USING: accessors classes classes.tuple classes.tuple.private
|
||||||
classes.tuple.private combinators combinators.smart fry functors
|
combinators combinators.smart functors2 kernel math sequences
|
||||||
kernel macros math parser sequences sequences.private ;
|
sequences.private ;
|
||||||
FROM: inverse => undo ;
|
FROM: inverse => undo ;
|
||||||
IN: tuple-arrays
|
IN: tuple-arrays
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue