diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-23 21:59:50 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-23 21:59:50 -0500 |
| commit | 6301e0b6374cecc5599665be14d6ddc6a31ce1e8 (patch) | |
| tree | dbf1dc2ff6c682fd87c72a7907e7f6e59c8d4c03 /bash | |
| parent | 89bd4de1e2704c1bc562788b2c5e4fc08b71a538 (diff) | |
| download | mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.tar.gz mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.zip | |
All: TCO let* and quasiquote.
Diffstat (limited to 'bash')
| -rwxr-xr-x | bash/step5_tco.sh | 6 | ||||
| -rwxr-xr-x | bash/step6_file.sh | 6 | ||||
| -rwxr-xr-x | bash/step7_quote.sh | 11 | ||||
| -rwxr-xr-x | bash/step8_macros.sh | 11 | ||||
| -rwxr-xr-x | bash/step9_interop.sh | 11 | ||||
| -rwxr-xr-x | bash/stepA_more.sh | 11 |
6 files changed, 36 insertions, 20 deletions
diff --git a/bash/step5_tco.sh b/bash/step5_tco.sh index b57c1f7..ea5b72d 100755 --- a/bash/step5_tco.sh +++ b/bash/step5_tco.sh @@ -71,8 +71,10 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; do) _count "${ast}" _slice "${ast}" 1 $(( ${r} - 2 )) EVAL_AST "${r}" "${env}" diff --git a/bash/step6_file.sh b/bash/step6_file.sh index 5f26335..168698a 100755 --- a/bash/step6_file.sh +++ b/bash/step6_file.sh @@ -71,8 +71,10 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; do) _count "${ast}" _slice "${ast}" 1 $(( ${r} - 2 )) EVAL_AST "${r}" "${env}" diff --git a/bash/step7_quote.sh b/bash/step7_quote.sh index f1a91ca..8319f64 100755 --- a/bash/step7_quote.sh +++ b/bash/step7_quote.sh @@ -109,15 +109,18 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; quote) r="${a1}" return ;; quasiquote) QUASIQUOTE "${a1}" - EVAL "${r}" "${env}" - return ;; + ast="${r}" + # Continue loop + ;; do) _count "${ast}" _slice "${ast}" 1 $(( ${r} - 2 )) EVAL_AST "${r}" "${env}" diff --git a/bash/step8_macros.sh b/bash/step8_macros.sh index 7826bf2..b21c25f 100755 --- a/bash/step8_macros.sh +++ b/bash/step8_macros.sh @@ -136,15 +136,18 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; quote) r="${a1}" return ;; quasiquote) QUASIQUOTE "${a1}" - EVAL "${r}" "${env}" - return ;; + ast="${r}" + # Continue loop + ;; defmacro!) local k="${ANON["${a1}"]}" EVAL "${a2}" "${env}" diff --git a/bash/step9_interop.sh b/bash/step9_interop.sh index 04d3413..5e4828f 100755 --- a/bash/step9_interop.sh +++ b/bash/step9_interop.sh @@ -136,15 +136,18 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; quote) r="${a1}" return ;; quasiquote) QUASIQUOTE "${a1}" - EVAL "${r}" "${env}" - return ;; + ast="${r}" + # Continue loop + ;; defmacro!) local k="${ANON["${a1}"]}" EVAL "${a2}" "${env}" diff --git a/bash/stepA_more.sh b/bash/stepA_more.sh index 88f2d4f..7f582c3 100755 --- a/bash/stepA_more.sh +++ b/bash/stepA_more.sh @@ -136,15 +136,18 @@ EVAL () { ENV_SET "${let_env}" "${ANON["${let_pairs[${idx}]}"]}" "${r}" idx=$(( idx + 2)) done - EVAL "${a2}" "${let_env}" - return ;; + ast="${a2}" + env="${let_env}" + # Continue loop + ;; quote) r="${a1}" return ;; quasiquote) QUASIQUOTE "${a1}" - EVAL "${r}" "${env}" - return ;; + ast="${r}" + # Continue loop + ;; defmacro!) local k="${ANON["${a1}"]}" EVAL "${a2}" "${env}" |
