packages feed

egison-5.0.0: sample/io/cut.egi

--
-- This file has been auto-generated by egison-translator.
--

def main (args: [String]) : IO () :=
  match args as list string with
    | $file :: $nums -> cut file (map read nums)

def cut (file: String) (nums: [Integer]) : IO () :=
  do let port := openInputFile file
     eachLineFromPort
       port
       (\line ->
         let fs := S.split "," line
          in print (S.intercalate "," (map 1#(nth $1 fs) nums)))
     closeInputPort port