diff options
Diffstat (limited to 'php')
| -rw-r--r-- | php/Makefile | 2 | ||||
| -rw-r--r-- | php/stepA_mal.php (renamed from php/stepA_interop.php) | 14 | ||||
| -rw-r--r-- | php/tests/stepA_mal.mal (renamed from php/tests/stepA_interop.mal) | 0 |
3 files changed, 14 insertions, 2 deletions
diff --git a/php/Makefile b/php/Makefile index d9fd2d4..659e89c 100644 --- a/php/Makefile +++ b/php/Makefile @@ -2,7 +2,7 @@ TESTS = SOURCES_BASE = readline.php types.php reader.php printer.php -SOURCES_LISP = env.php core.php stepA_interop.php +SOURCES_LISP = env.php core.php stepA_mal.php SOURCES = $(SOURCES_BASE) $(SOURCES_LISP) .PHONY: stats tests $(TESTS) diff --git a/php/stepA_interop.php b/php/stepA_mal.php index 8c67c66..1dc3b04 100644 --- a/php/stepA_interop.php +++ b/php/stepA_mal.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]; diff --git a/php/tests/stepA_interop.mal b/php/tests/stepA_mal.mal index 15f8a94..15f8a94 100644 --- a/php/tests/stepA_interop.mal +++ b/php/tests/stepA_mal.mal |
