From 2ab1e5845c213a9951bee46a0c991202e6c46d5c Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sat, 28 Feb 2015 10:35:04 -0600 Subject: Multiple: interop enhancements. --- php/stepA_interop.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'php/stepA_interop.php') diff --git a/php/stepA_interop.php b/php/stepA_interop.php index 8c67c66..1dc3b04 100644 --- a/php/stepA_interop.php +++ b/php/stepA_interop.php @@ -109,7 +109,19 @@ function MAL_EVAL($ast, $env) { case "macroexpand": return macroexpand($ast[1], $env); case "php*": - return eval($ast[1]); + $res = eval($ast[1]); + switch (gettype($res)) { + case "array": + if ($res !== array_values($res)) { + $new_res = _hash_map(); + $new_res->exchangeArray($res); + return $new_res; + } else { + return call_user_func_array('_list', $res); + } + default: + return $res; + } case "try*": $a1 = $ast[1]; $a2 = $ast[2]; -- cgit v1.2.3