Skip to content

Commit

Permalink
Bash, PHP: fix nested hash-map equality.
Browse files Browse the repository at this point in the history
  • Loading branch information
kanaka committed Dec 3, 2015
1 parent fef22d1 commit 33d33bb
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bash/step2_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step3_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step4_if_fn_do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step5_tco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step6_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step7_quote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step8_macros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/step9_try.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
2 changes: 1 addition & 1 deletion bash/stepA_mal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ EVAL_AST () {
vector)
_map_with_type _vector EVAL "${ast}" "${env}" ;;
hash_map)
local res="" val="" hm="${ANON["${ast}"]}"
local res="" key= val="" hm="${ANON["${ast}"]}"
_hash_map; local new_hm="${r}"
eval local keys="\${!${hm}[@]}"
for key in ${keys}; do
Expand Down
4 changes: 1 addition & 3 deletions php/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ function _equal_Q($a, $b) {
$hm1 = $a->getArrayCopy();
$hm2 = $b->getArrayCopy();
foreach (array_keys($hm1) as $k) {
if ($hm1[$k] !== $hm2[$k]) {
return false;
}
if (!_equal_Q($hm1[$k], $hm2[$k])) { return false; }
}
return true;
} else {
Expand Down

0 comments on commit 33d33bb

Please sign in to comment.