This commit is contained in:
Dmitry Boulytchev 2018-04-26 22:31:47 +03:00
parent dd5956d663
commit 25eff5c282
3 changed files with 7 additions and 5 deletions

View file

@ -85,8 +85,11 @@ module Builtin =
)
| "$length" -> (st, i, o, Some (Value.of_int (match List.hd args with Value.Array a -> List.length a | Value.String s -> String.length s)))
| "$array" -> (st, i, o, Some (Value.of_array args))
| s -> failwith (Printf.sprintf "Wow: %s\n" s)
| "strcat" -> let [x; y] = args in
(st, i, o, Some (Value.of_string @@ Value.to_string x ^ Value.to_string y))
| "isArray" -> let [a] = args in
(st, i, o, Some (Value.of_int @@ match a with Array _ -> 1 | _ -> 0))
end
(* Simple expressions: syntax and semantics *)