From de04357cd5f2954e2d682abb97ca2b3b90ea75d1 Mon Sep 17 00:00:00 2001 From: Chouser Date: Fri, 23 Jan 2015 20:05:03 -0500 Subject: Ocaml: Add string functions --- ocaml/types.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ocaml/types.ml') diff --git a/ocaml/types.ml b/ocaml/types.ml index 60d3725..badfee3 100644 --- a/ocaml/types.ml +++ b/ocaml/types.ml @@ -7,3 +7,7 @@ type mal_type = | Bool of bool | String of string | Fn of (mal_type list -> mal_type) + +let to_bool x = match x with + | Nil | Bool false -> false + | _ -> true -- cgit v1.2.3