Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 0e6242f2fbeb1605795e6cc9f8f2860ba68b0f83 @technomancy committed Aug 9, 2011
Showing with 23 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +19 −0 erythrina.ml
@@ -0,0 +1,4 @@
+/erythrina
+/erythrina.cmi
+/erythrina.cmo
+/erythrina.annot
@@ -0,0 +1,19 @@
+let rec read_lines lines =
+ try read_lines (read_line () :: lines)
+ with End_of_file -> lines
+
+let lines = read_lines []
+
+let matcher input matched line =
+ if input = line then
+ line :: matched
+ else
+ matched
+
+let pat = "hello"
+
+let matched = List.fold_left (matcher pat) [] lines
+
+let matched_string = String.concat "\n" matched
+
+;; print_string matched_string

0 comments on commit 0e6242f

Please sign in to comment.