Skip to content

Instantly share code, notes, and snippets.

/ls.ml Secret

Created October 5, 2014 21:28
Show Gist options
  • Save anonymous/ac176060126cbd633c97 to your computer and use it in GitHub Desktop.
Save anonymous/ac176060126cbd633c97 to your computer and use it in GitHub Desktop.
How do I compile this?
open Core.Std
module Regex = Re2.Regex
let ls pattern =
let pat = Regex.create_exn pattern in
let matcher = Regex.matches pat in
Sys.ls_dir "."
|> List.filter ~f:matcher
|> List.iter ~f:(fun s -> print_string s; print_newline ())
let () =
match In_channel.input_line stdin with
| None -> (print_string "No Input"; print_newline ())
| Some pat -> ls pat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment