Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Text-processing-2/F-Sharp/text-processing-2-1.fs
Normal file
19
Task/Text-processing-2/F-Sharp/text-processing-2-1.fs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
let file = @"readings.txt"
|
||||
|
||||
let dates = HashSet(HashIdentity.Structural)
|
||||
let mutable ok = 0
|
||||
|
||||
do
|
||||
for line in System.IO.File.ReadAllLines file do
|
||||
match String.split [' '; '\t'] line with
|
||||
| [] -> ()
|
||||
| date::xys ->
|
||||
if dates.Contains date then
|
||||
printf "Date %s is duplicated\n" date
|
||||
else
|
||||
dates.Add date
|
||||
let f (b, t) h = not b, if b then int h::t else t
|
||||
let _, states = Seq.fold f (false, []) xys
|
||||
if Seq.forall (fun s -> s >= 1) states then
|
||||
ok <- ok + 1
|
||||
printf "%d records were ok\n" ok
|
||||
6
Task/Text-processing-2/F-Sharp/text-processing-2-2.fs
Normal file
6
Task/Text-processing-2/F-Sharp/text-processing-2-2.fs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Date 1990-03-25 is duplicated
|
||||
Date 1991-03-31 is duplicated
|
||||
Date 1992-03-29 is duplicated
|
||||
Date 1993-03-28 is duplicated
|
||||
Date 1995-03-26 is duplicated
|
||||
5017 records were ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue