Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit.

  • Loading branch information...
commit 0e6242f2fbeb1605795e6cc9f8f2860ba68b0f83 0 parents
Phil Hagelberg authored

Showing 2 changed files with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 .gitignore
  2. +19 0 erythrina.ml
4 .gitignore
... ... @@ -0,0 +1,4 @@
  1 +/erythrina
  2 +/erythrina.cmi
  3 +/erythrina.cmo
  4 +/erythrina.annot
19 erythrina.ml
... ... @@ -0,0 +1,19 @@
  1 +let rec read_lines lines =
  2 + try read_lines (read_line () :: lines)
  3 + with End_of_file -> lines
  4 +
  5 +let lines = read_lines []
  6 +
  7 +let matcher input matched line =
  8 + if input = line then
  9 + line :: matched
  10 + else
  11 + matched
  12 +
  13 +let pat = "hello"
  14 +
  15 +let matched = List.fold_left (matcher pat) [] lines
  16 +
  17 +let matched_string = String.concat "\n" matched
  18 +
  19 +;; print_string matched_string

0 comments on commit 0e6242f

Please sign in to comment.
Something went wrong with that request. Please try again.