factor: update for load-all
							parent
							
								
									3a430c4dae
								
							
						
					
					
						commit
						ee67a4d8d2
					
				| 
						 | 
				
			
			@ -71,10 +71,10 @@ M: pathname url-of
 | 
			
		|||
    swap "\n" glue XML-CHUNK[[ <style><-></style> ]] ;
 | 
			
		||||
 | 
			
		||||
: help-meta ( -- xml )
 | 
			
		||||
    [XML <meta
 | 
			
		||||
    XML-CHUNK[[ <meta
 | 
			
		||||
            name="viewport"
 | 
			
		||||
            content="width=device-width, initial-scale=1"
 | 
			
		||||
        /> XML] ;
 | 
			
		||||
        /> ]] ;
 | 
			
		||||
 | 
			
		||||
: help-navbar ( -- xml )
 | 
			
		||||
    "conventions" >link topic>filename
 | 
			
		||||
| 
						 | 
				
			
			@ -99,23 +99,23 @@ M: pathname url-of
 | 
			
		|||
    dup '[ drop _ assoc-size 1 + bijective-base26 ] cache ;
 | 
			
		||||
 | 
			
		||||
: css-style ( style -- style' )
 | 
			
		||||
    R/ font-size: \d+pt;/ [
 | 
			
		||||
    re"font-size: \d+pt;" [
 | 
			
		||||
        "font-size: " ?head drop "pt;" ?tail drop
 | 
			
		||||
        string>number 2 -
 | 
			
		||||
        "font-size: %dpt;" sprintf
 | 
			
		||||
    ] re-replace-with
 | 
			
		||||
 | 
			
		||||
    R/ padding: \d+px;/ [
 | 
			
		||||
    re"padding: \d+px;" [
 | 
			
		||||
        "padding: " ?head drop "px;" ?tail drop
 | 
			
		||||
        string>number dup even? [ 2 * 1 + ] [ 2 * ] if
 | 
			
		||||
        number>string "padding: " "px;" surround
 | 
			
		||||
    ] re-replace-with
 | 
			
		||||
 | 
			
		||||
    R/ width: \d+px;/ [
 | 
			
		||||
    re"width: \d+px;" [
 | 
			
		||||
       drop ""
 | 
			
		||||
    ] re-replace-with
 | 
			
		||||
 | 
			
		||||
    R/ font-family: monospace;/ [
 | 
			
		||||
    re"font-family: monospace;" [
 | 
			
		||||
        " white-space: pre-wrap; line-height: 125%;" append
 | 
			
		||||
    ] re-replace-with ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -147,7 +147,7 @@ M: pathname url-of
 | 
			
		|||
    [
 | 
			
		||||
        [ print-topic ] with-html-writer css-styles-to-classes
 | 
			
		||||
        [ 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 ;
 | 
			
		||||
 | 
			
		||||
: generate-help-file ( topic -- )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ CHLOE: script
 | 
			
		|||
CHLOE: write-script
 | 
			
		||||
    drop [
 | 
			
		||||
        get-script
 | 
			
		||||
        [XML <script type="text/javascript"> <-> </script> XML]
 | 
			
		||||
        XML-CHUNK[[ <script type="text/javascript"> <-> </script> ]]
 | 
			
		||||
    ] [xml-code] ;
 | 
			
		||||
 | 
			
		||||
CHLOE: meta
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ SYMBOL: meta
 | 
			
		|||
 | 
			
		||||
: get-meta ( -- xml )
 | 
			
		||||
    meta get [
 | 
			
		||||
        [XML <meta name=<-> content=<->/> XML]
 | 
			
		||||
        XML-CHUNK[[ <meta name=<-> content=<->/> ]]
 | 
			
		||||
    ] { } assoc>map ;
 | 
			
		||||
 | 
			
		||||
: write-meta ( -- )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -290,7 +290,7 @@ HELP: <anti-diagonal-matrix>
 | 
			
		|||
 | 
			
		||||
HELP: <identity-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
 | 
			
		||||
    { $example
 | 
			
		||||
        "USING: math.matrices prettyprint ;"
 | 
			
		||||
| 
						 | 
				
			
			@ -377,7 +377,7 @@ HELP: <cartesian-indices>
 | 
			
		|||
 | 
			
		||||
HELP: <cartesian-square-indices>
 | 
			
		||||
{ $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
 | 
			
		||||
    { $equiv-word-note "square" <cartesian-indices> }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -434,7 +434,7 @@ HELP: <square-cols>
 | 
			
		|||
 | 
			
		||||
HELP: <lower-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
 | 
			
		||||
    { $example
 | 
			
		||||
        "USING: math.matrices prettyprint ;"
 | 
			
		||||
| 
						 | 
				
			
			@ -451,7 +451,7 @@ HELP: <lower-matrix>
 | 
			
		|||
 | 
			
		||||
HELP: <upper-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
 | 
			
		||||
    { $example
 | 
			
		||||
        "USING: math.matrices prettyprint ;"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ ALIAS: transpose flip
 | 
			
		|||
 | 
			
		||||
: unshaped-cols-iota ( matrix -- cols-iota )
 | 
			
		||||
  [ 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 )
 | 
			
		||||
    [ <reversed> [ nth-end-unsafe ] with { } map-as ] curry { } map-as ; inline
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
! Copyright (C) 2009, 2010 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: accessors arrays classes classes.tuple
 | 
			
		||||
classes.tuple.private combinators combinators.smart fry functors
 | 
			
		||||
kernel macros math parser sequences sequences.private ;
 | 
			
		||||
USING: accessors classes classes.tuple classes.tuple.private
 | 
			
		||||
combinators combinators.smart functors2 kernel math sequences
 | 
			
		||||
sequences.private ;
 | 
			
		||||
FROM: inverse => undo ;
 | 
			
		||||
IN: tuple-arrays
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue