Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
open System
|
||||
open System.IO
|
||||
|
||||
let cutOut (arr : 'a[]) from n = // confine syntax highlighting confusion'
|
||||
let slicer = fun i -> if i < from || (from + n) <= i then Some(arr.[i-1]) else None
|
||||
((Array.choose slicer [| 1 .. arr.Length |]), from + n - arr.Length > 1)
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
let nums = Array.choose (System.Int32.TryParse >> function | true, v -> Some v | false, _ -> None) argv.[1..2]
|
||||
let lines = File.ReadAllLines(argv.[0])
|
||||
let (sliced, tooShort) = cutOut lines nums.[0] nums.[1]
|
||||
if tooShort then Console.Error.WriteLine "Not enough lines"
|
||||
File.WriteAllLines(argv.[0], sliced)
|
||||
0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
D:\Projects\Rosetta>for /l %i in (1,1,5) do @echo %i >> foo
|
||||
|
||||
D:\Projects\Rosetta>Remove_lines_from_a_file.exe foo 1 2
|
||||
|
||||
D:\Projects\Rosetta>type foo
|
||||
3
|
||||
4
|
||||
5
|
||||
|
||||
D:\Projects\Rosetta>
|
||||
Loading…
Add table
Add a link
Reference in a new issue