]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.regex-dna: We have to read the input and output files with \n
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 12 Apr 2020 18:23:38 +0000 (11:23 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 12 Apr 2020 18:23:38 +0000 (11:23 -0700)
line endings.

extra/benchmark/regex-dna/regex-dna.factor

index e6a6f6c56c4143d3b2071a7cfc8b7c9b94998375..1d03fce9e2c912fda0bac74361463b5837d940a4 100644 (file)
@@ -44,8 +44,9 @@ IN: benchmark.regex-dna
 SYMBOL: ilen
 SYMBOL: clen
 
+! Make sure we read the file with \n as the newline delimiter.
 : regex-dna ( file -- )
-    ascii file-contents dup length ilen set
+    ascii file-lines [ "\n" append ] map concat dup length ilen set
     strip-line-breaks dup length clen set
     dup count-patterns
     do-replacements