tracks/ocaml/exercises/bracket-push/example.ml in trackler-2.2.1.110 vs tracks/ocaml/exercises/bracket-push/example.ml in trackler-2.2.1.111
- old
+ new
@@ -1,6 +1,6 @@
-open Core
+open Base
type 'a stack = 'a list
let push (s: 'a stack) (a: 'a): 'a stack = a :: s
let pop (s: 'a stack): ('a * 'a stack) option = match s with
@@ -15,10 +15,10 @@
otherwise return None (to indicate matching failure). *)
let update (s: (char stack) option) (ch: char): (char stack) option =
match s with
| None -> None
| Some s ->
- let pop_matching m = Option.filter (pop s) ~f:(fun (top, _) -> top = m)
+ let pop_matching m = Option.filter (pop s) ~f:(fun (top, _) -> Char.(top = m))
|> Option.map ~f:snd in
match ch with
| '(' | '{' | '[' -> Some (push s ch)
| ')' -> pop_matching '('
| '}' -> pop_matching '{'