]> gitweb.factorcode.org Git - factor.git/commitdiff
documents: rename each-line to each-doc-line and map-lines to map-doc-lines
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 4 Feb 2022 04:27:53 +0000 (20:27 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 4 Feb 2022 04:30:04 +0000 (20:30 -0800)
basis/documents/documents-docs.factor
basis/documents/documents.factor

index 750a650345f1ac8fa0278b7b2026d5b8fd708ea5..eedf9db8c3416a9dd4b95c990ce60fb48ca03db3 100644 (file)
@@ -42,7 +42,7 @@ HELP: doc-lines
 { $notes "The range is created by calling " { $link <slice> } "." }
 { $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ;
 
-HELP: each-line
+HELP: each-doc-line
 { $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "quot" { $quotation ( ... line -- ... ) } } }
 { $description "Applies the quotation to each line in the range." }
 { $notes "The range is created by calling " { $link <slice> } "." }
@@ -119,7 +119,10 @@ ARTICLE: "documents" "Documents"
     remove-doc-range
 }
 "A combinator:"
-{ $subsections each-line }
+{ $subsections
+    each-doc-line
+    map-doc-lines
+}
 "More info:"
 { $subsections
     "document-locs"
index 4b6aa3ee53034e332bed028ee834f9ef2ae3af36..65a20ab66bcbe0f70d51426500c09b5574df1c5c 100644 (file)
@@ -53,13 +53,13 @@ TUPLE: document < model locs undos redos inside-undo? ;
     to first line# =
     [ to second ] [ line# document doc-line length ] if ;
 
-: each-line ( ... from to quot: ( ... line -- ... ) -- ... )
+: each-doc-line ( ... from to quot: ( ... line -- ... ) -- ... )
     2over = [ 3drop ] [
         [ [ first ] bi@ [a..b] ] dip each
     ] if ; inline
 
-: map-lines ( ... from to quot: ( ... line -- ... result ) -- ... results )
-    collector [ each-line ] dip ; inline
+: map-doc-lines ( ... from to quot: ( ... line -- ... result ) -- ... results )
+    collector [ each-doc-line ] dip ; inline
 
 : start/end-on-line ( from to line# document -- n1 n2 )
     [ start-on-line ] [ end-on-line ] bi-curry bi-curry bi* ;
@@ -116,7 +116,7 @@ CONSTANT: doc-start { 0 0 }
 PRIVATE>
 
 :: doc-range ( from to document -- string )
-    from to [ [ from to ] dip document (doc-range) ] map-lines
+    from to [ [ from to ] dip document (doc-range) ] map-doc-lines
     join-lines ;
 
 : add-undo ( edit document -- )