]> gitweb.factorcode.org Git - factor.git/commitdiff
help.lint.checks: adjust checks for whitespace
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 18 Aug 2023 00:24:22 +0000 (17:24 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 18 Aug 2023 00:24:22 +0000 (17:24 -0700)
basis/help/lint/checks/checks.factor
basis/help/tour/tour.factor
extra/brain-flak/brain-flak-docs.factor
extra/generators/generators-docs.factor
extra/lint/vocabs/vocabs-docs.factor
extra/mediawiki/api/api-docs.factor

index a6084b2da6302f52ed35a36d9a28aca67e81da7c..4097364f31140ad37c48964d9ec2f8604bac42a5 100644 (file)
@@ -154,7 +154,7 @@ SYMBOL: vocab-articles
     ] bi ;
 
 : check-whitespace ( str1 str2 -- )
-    [ " " tail? ] [ " " head? ] bi* or
+    [ ?last " (" member? ] [ ?first " )." member? ] bi* or
     [ "Missing whitespace between strings" simple-lint-error ] unless ;
 
 : check-bogus-nl ( element -- )
index f62383b04c208a2efe4a630ecc7d4392eeed309e..5345704bca44fa4035cde9a449d79974f2368517 100644 (file)
@@ -93,7 +93,7 @@ and in familiar infix notation
 Also notice that we have been able to split our computation onto many lines or combine it onto fewer lines rather arbitrarily, and that each line made sense in itself.
 ;
 
-ARTICLE: "tour-first-word" "Defining our first word" 
+ARTICLE: "tour-first-word" "Defining our first word"
 
 We will now define our first function. Factor has slightly odd naming of functions: since functions are read from left 
 to right, they are simply called { $strong "words" } , and this is what we'll call them from now on. Modules in Factor define 
@@ -181,7 +181,7 @@ Our definitions have become simpler and there was no need to pass parameters, re
 else that would have been necessary to refactor our function in most languages.
 
 Of course, Factor already has a word for calculating factorial (there is a whole { $vocab-link "math.factorials" }  
-vocabulary, including many variants of the usual factorial) and a word for calculating product "(" { $link product }  in the 
+vocabulary, including many variants of the usual factorial) and a word for calculating product " (" { $link product }  in the 
 { $vocab-link "sequences" }  vocabulary), but as it often happens, introductory examples overlap with the standard library.
 ;
 
@@ -358,7 +358,7 @@ Generate a template for a vocabulary writing
 \"github.tutorial\" scaffold-work" }
 
 You will find a file { $snippet "work/github/tutorial/tutorial.factor" } containing an empty vocabulary. Factor integrates with 
-many editors, so you can try { $snippet "\"github.tutorial\" edit" } ":" this will prompt you to choose your favourite editor, and use that 
+many editors, so you can try { $snippet "\"github.tutorial\" edit" } ": " this will prompt you to choose your favourite editor, and use that 
 editor to open the newly created vocabulary.
 
 You can add the definitions of the previous paragraph, so that it looks like
@@ -566,7 +566,7 @@ C: <movie> movie
 
 In other cases, you may want to use some defaults, or compute some fields.
 
-The functional minded will be worried about the mutability of tuples. Actually, slots can be declared to be "read-only" 
+The functional minded will be worried about the mutability of tuples. Actually, slots can be declared to be " read-only "
 with { $snippet "{ slot-name read-only } " } . In this case, the field setter will not be generated, and the value must be set a the 
 beginning with a boa constructor. Other valid slot modifiers are { $link POSTPONE: initial: } - to declare a default value - and a class word
 , such as { $snippet "integer" } , to restrict the values that can be inserted.
@@ -707,7 +707,7 @@ DEFER: fib-rec
 : fib-rec ( n -- f(n) ) [ 1 - fib ] [ 2 - fib ] bi + ;
 " }
 
-(notice the use of { $link POSTPONE: DEFER: } to define two mutually "recursive" words). You can benchmark the running time writing { $snippet "40 fib" }  
+(notice the use of { $link POSTPONE: DEFER: } to define two mutually " recursive " words). You can benchmark the running time writing { $snippet "40 fib" }  
 and then pressing Ctrl+t instead of Enter. You will get timing information, as well as other statistics. Programmatically
 , you can use the { $link time } word on a quotation to do the same.
 
@@ -775,7 +775,7 @@ can encode each with two bits. Let use define a word that operates on characters
 where the first bit represents whether the basis is a purine or a pyrimidine, and the second one identifies bases that 
 pair together.
 
-Our aim is to read a sequence of letters a, c, g, "t" - possibly with spaces - and convert them to a bit array. Factor 
+Our aim is to read a sequence of letters a, c, g, " t " - possibly with spaces - and convert them to a bit array. Factor 
 supports bit arrays, and literal bit arrays look like { $snippet "?{ f f t }" } .
 
 Our syntax for DNA will start with { $snippet "DNA{" } and get all tokens until the closing token { $snippet "}" } is found. The intermediate 
@@ -799,7 +799,7 @@ SYNTAX: DNA{ \"}\" parse-tokens concat
 
 Notice the use of { $link map-as } instead of { $link map } . Since the target collection is not a string, we did not use { $link map } , which 
 preserves the type, but { $link map-as } , which take as an additional argument an examplar of the target collection - here { $snippet "{ }" } .
-Our "final" version flattens the array of pairs with { $link concat } and finally makes into a bit array:
+Our " final " version flattens the array of pairs with { $link concat } and finally makes into a bit array:
 
 { $code "
 SYNTAX: DNA{ \"}\" parse-tokens concat
@@ -895,7 +895,7 @@ Using { $link with }  instead of { $link curry } , this simplifies to
 : prime? ( n -- ? )
     2 over sqrt [a,b] [ divisor? ] with any? not ;" }
 
-If you are not able to visualize what is happening, you may want to consider the { $vocab-link "fry" } vocabulary. It defines { $strong "fried quotations" } ";
+If you are not able to visualize what is happening, you may want to consider the { $vocab-link "fry" } vocabulary. It defines { $strong "fried quotations" } "; "
 these are quotations that have holes in them - marked by { $snippet "_" } - that are filled with values from the stack.
 
 The first quotation is rewritten more simply as
@@ -1002,7 +1002,7 @@ Using the helper word { $link with-file-reader } , we can also shorten this to
     ] with-file-reader ;" }
 
 Unfortunately, we are limited to one line. To read more lines, we should chain calls to { $link readln } until one returns { $link f } .
-Factor helps us with { $link file-lines } , which lazily iterates "over" lines. Our "final" definition becomes
+Factor helps us with { $link file-lines } , which lazily iterates over lines. Our " final " definition becomes
 
 { $code "
 : read-first-letters ( path -- )
@@ -1157,7 +1157,7 @@ Let us define a word for the thread workload
 : print-a-line ( i -- )
     star-wars get ?nth print ;" }
 
-If we give the i-th thread the name "\"i\"" , our example amounts to
+If we give the i-th thread the name { $snippet "i" } , our example amounts to
 
 { $code "
 18 [0..b) [
index fc2d8f88e97e6792ffaa2a2d465323955a35e491..00b357fc13d8fa16cb314f4b842fbf3e1c074d70 100644 (file)
@@ -104,7 +104,7 @@ HELP: compile-brain-flak
 { $see-also POSTPONE: b-f" with-brain-flak } ;
 
 ARTICLE: "brain-flak" "Introduction to brain-flak"
-{ { $url URL"https://esolangs.org/wiki/Brain-Flak" "Brain-flak" } " is a stack-based esoteric language designed by Programming Puzzles and Code-Golf user " { $url URL"https://codegolf.stackexchange.com/users/31716/djmcmayhem" "DjMcMayhem" } } . The name is a cross between "\"brainfuck\"" , which was a big inspiration for the language, and "\"flak-overstow\"" , since the language is confusing and stack-based.
+{ { $url URL"https://esolangs.org/wiki/Brain-Flak" "Brain-flak" } " is a stack-based esoteric language designed by Programming Puzzles and Code-Golf user " { $url URL"https://codegolf.stackexchange.com/users/31716/djmcmayhem" "DjMcMayhem" } } . The name is a cross between " \"brainfuck\" " , which was a big inspiration for the language, and " \"flak-overstow\" " , since the language is confusing and stack-based.
 
 { $heading "Overview" }
 Brain-flak is an expression-based language written only using brackets, which must be balanced. Any other character will be ignored. Its only data type is a signed integer, which in this implementation has unbounded size.
index 07919a051529dabdb4785bca227a1b87e057d23b..b872843789c1cd41eea2937ab5f851bfc736a50e 100644 (file)
@@ -135,7 +135,7 @@ HELP: yield-from
 { $description "Delegate computation to the specified generator until it is exhausted, before resuming computation in the current generator." } ;
 
 ARTICLE: "generators" "Generators"
-"Generators in Factor are lazily executed blocks of code, which emit values on request. They are designed to work very similarly to generators found in languages like Python or JavaScript."
+"Generators in Factor are lazily executed blocks of code, which emit values on request. They are designed to work very similarly to generators found in languages like Python or JavaScript. "
 "Their implementation in Factor is a simple wrapper around " { $vocab-link "coroutines" } "."
 $nl
 "Generator words are created using " { $link \ GEN: } " or " { $link \ GEN:: } ". When a generator word is called, its required inputs are consumed from the stack, and a " { $link generator } " object is left as output. Accordingly, the right hand side of generator word's stack effect must always be a single value. For example:"
@@ -154,7 +154,7 @@ $nl
 { $subsections next* ?next* skip* }
 "Check if a generator is already exhausted:"
 { $subsections exhausted? }
-"All generator words are found in the " { $vocab-link "generators" } "vocabulary."
+"All generator words are found in the " { $vocab-link "generators" } " vocabulary."
 ;
 
 ABOUT: "generators"
index da9c3d7f3eb713c49139042c19c81b6b5c094e92..b6ce27327e7991397ab248b1b4add922972e8f8e 100644 (file)
@@ -59,11 +59,11 @@ HELP: find-unused.
 
 
 ARTICLE: "lint.vocabs" "The Unused Vocabulary Linter"
-"The " { $vocab-link "lint.vocabs" } " vocabulary implements a set of words designed to find unused imports."
-"It attempts to ignore USE: and USING: that are a part of a string, postponed with either POSTPONE: or \\, and
+"The " { $vocab-link "lint.vocabs" } " vocabulary implements a set of words designed to find unused imports. "
+"It attempts to ignore USE: and USING: that are a part of a string, postponed with either POSTPONE: or \\, and "
 "contained inside a " { $link "regexp" } "."
 $nl
-"It can sometimes be easy to lose track of what vocabularies you've imported while iterating over ideas. So to"
+"It can sometimes be easy to lose track of what vocabularies you've imported while iterating over ideas. So to "
 "find any vocabularies you feel are unused, you can run:"
 $nl
 { $example 
index bbb01cf531817970501f69784c29a562a8188b69..d04ed8bef85ed0ff684911a58b2d03b735ca7167 100644 (file)
@@ -4,7 +4,7 @@ IN: mediawiki.api
 ARTICLE: "mediawiki.api" "MediaWiki API"
 { $url "https://www.mediawiki.org/wiki/API:Main_page" }
 { $heading "Configuration" }
-"Set " { $snippet "endpoint" } " to the API entry point. An"
+"Set " { $snippet "endpoint" } " to the API entry point. An "
 "example for Wikimedia wikis:"
 { $code
 "USING: formatting mediawiki.api namespaces ;"
@@ -13,8 +13,8 @@ ARTICLE: "mediawiki.api" "MediaWiki API"
 "\"en\" \"wikipedia\" wikimedia-url endpoint set-global" }
 $nl
 "For Wikimedia wikis, also provide contact information in " {
-$snippet "contact" } " so that wiki operators can contact you in"
-"case of malfunction, including username or email, and possibly"
+$snippet "contact" } " so that wiki operators can contact you in "
+"case of malfunction, including username or email, and possibly "
 "the task name:"
 { $code
 "USING: mediawiki.api namespaces ;"
@@ -36,13 +36,13 @@ $nl
 "\"password\""
 "<password-login> password-login set-global" }
 $nl
-"If both login methods are given, OAuth is preferred. If none"
+"If both login methods are given, OAuth is preferred. If none "
 "are given, you're not logged in."
 $nl
-"If you use several wikis simultaneously, you might want to save"
-"your " { $snippet "cookies" } " (if you use the password login"
-"method) and your " { $snippet "csrf-token" } ". You also should"
-"invalidate your csrf-token before using an action that requires"
+"If you use several wikis simultaneously, you might want to save "
+"your " { $snippet "cookies" } " (if you use the password login "
+"method) and your " { $snippet "csrf-token" } ". You also should "
+"invalidate your csrf-token before using an action that requires "
 "a csrf token in a wiki for the first time:"
 { $code
 "USING: mediawiki.api namespaces ;"