Skip to content

Commit

Permalink
fix: fix cases with syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
henrylee97 committed Nov 8, 2023
1 parent 63e1155 commit 5faef23
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions OCaml/lambda-13/buggy/src.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ and var = string

let rec check (a : lambda) : bool =
match a with
| V _ -> raise Invalid_argument "check"
| C (a, b) -> raise Invalid_argument "check"
| V _ -> raise (Invalid_argument "check")
| C (a, b) -> raise (Invalid_argument "check")
| P (a, V b) -> if a = b then true else false
| P (a, C (V b, V c)) -> if a = b || a = c then true else false
| P (a, C (P (b, V c), V d)) -> if a = c || a = d then true else false
Expand Down
4 changes: 2 additions & 2 deletions OCaml/lambda-14/buggy/src.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ and var = string

let rec check (a : lambda) : bool =
match a with
| V _ -> raise Invalid_argument "check"
| C (a, b) -> raise Invalid_argument "check"
| V _ -> raise (Invalid_argument "check")
| C (a, b) -> raise (Invalid_argument "check")
| P (a, V b) -> if a = b then true else false
| P (a, C (V b, V c)) -> if a = b || a = c then true else false
| P (a, C (P (b, V c), V d)) -> if a = c && a = d then true else false
Expand Down
2 changes: 1 addition & 1 deletion OCaml/lambda-6/buggy/src.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ let rec check (met : lambda) : bool =
| _ -> check2 a x && check2 a x )
in

match met with P (b, c) -> check2 b c | _ -> raise Error "Illegal input"
match met with P (b, c) -> check2 b c | _ -> raise (Error "Illegal input")
4 changes: 2 additions & 2 deletions OCaml/lambda-95/buggy/src.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ and var = string

let isinthelist (l : 'a list) a : bool =
let temp : 'a list =
List.filter (fun x y -> if x != y then false else true a) l
List.filter ((fun x y -> if x != y then false else true) a) l
in

match temp with [] -> false | hd :: tl -> true


let isnotinthelist (l : 'b list) (a : string) : bool =
let temp : 'b list =
List.filter (fun x y -> if x != y then false else true a) l
List.filter ((fun x y -> if x != y then false else true) a) l
in

match temp with [] -> true | hd :: tl -> false
Expand Down

0 comments on commit 5faef23

Please sign in to comment.