Skip to content

Commit 9c5ee0c

Browse files
committed
Add F# - fsharp
1 parent ddfe70f commit 9c5ee0c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

filterls/filter.fs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
open System
2+
open System.IO
3+
4+
let processLine (line: string, output: StreamWriter) =
5+
let segs = line.Split([|" "|], 3, StringSplitOptions.RemoveEmptyEntries)
6+
if segs.Length >= 2 then
7+
let mutable value = 0L
8+
let isNum = Int64.TryParse(segs.[1], &value)
9+
if isNum && value > 10L then output.WriteLine(line)
10+
11+
let main() =
12+
let BUFSIZE = 8192
13+
let output = new StreamWriter(Console.OpenStandardOutput(BUFSIZE))
14+
let input = new StreamReader(Console.OpenStandardInput(BUFSIZE))
15+
let mutable eof = false
16+
while not eof do
17+
let line = input.ReadLine()
18+
if not (isNull line) then processLine(line, output) else eof <- true
19+
output.Close()
20+
21+
main()

0 commit comments

Comments
 (0)