diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-16 16:26:31 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-16 16:26:31 -0800 |
commit | b76485e540762c60ba34dc36875c3b936f4df7b8 (patch) | |
tree | 04f04f42e09bd11eaa3911840dc702a757b2308b | |
parent | 5cb820d7f9be3df23e19fd67a2f5ff6309188eea (diff) | |
download | txr-b76485e540762c60ba34dc36875c3b936f4df7b8.tar.gz txr-b76485e540762c60ba34dc36875c3b936f4df7b8.tar.bz2 txr-b76485e540762c60ba34dc36875c3b936f4df7b8.zip |
* eval.c (op_tree_case): Removed superfluous handling of
nil parameter list; this is correctly handled by bind_macro_params.
Added support for the colon symbol as an indication that
the case is declined.
* txr.1: Updated.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | eval.c | 13 | ||||
-rw-r--r-- | txr.1 | 11 |
3 files changed, 22 insertions, 11 deletions
@@ -1,5 +1,14 @@ 2014-02-16 Kaz Kylheku <kaz@kylheku.com> + * eval.c (op_tree_case): Removed superfluous handling of + nil parameter list; this is correctly handled by bind_macro_params. + Added support for the colon symbol as an indication that + the case is declined. + + * txr.1: Updated. + +2014-02-16 Kaz Kylheku <kaz@kylheku.com> + New destructuring operators. * eval.c (tree_case_s, tree_bind_s): New symbol variables. @@ -1107,15 +1107,12 @@ static val op_tree_case(val form, val env) for (; consp(cases); cases = cdr(cases)) { val onecase = car(cases); cons_bind (params, forms, onecase); - - if (!params) { - if (!expr_val) - return eval_progn(forms, env, forms); - } else { - val new_env = bind_macro_params(env, nil, params, expr_val, + val new_env = bind_macro_params(env, nil, params, expr_val, colon_k, onecase); - if (new_env) - return eval_progn(forms, new_env, forms); + if (new_env) { + val ret = eval_progn(forms, new_env, forms); + if (ret != colon_k) + return ret; } } @@ -12689,9 +12689,14 @@ style parameter list <macro-style-params>. If the object produced by <expr> matches <macro-style-params>, then the parameters are bound, becoming local variables, and the <form>-s, if any, are -evaluated in order in the environment in which those variables are visible. The -evaluation of tree-case then ends, returning the value of the last <form>, or -else nil if there are no forms. +evaluated in order in the environment in which those variables are visible. + +If there are forms, the value of the last <form> becomes the result value of +the case, otherwise the result value of the case is nil. + +If the result value of a case is the object : (the colon symbol), then +processing continues with the next case. Otherwise the evaluation of tree-case +terminates, returning the result value. If the value of <expr> does not match the <macro-style-params> parameter list, then the usual exception is thrown; instead, processing continues |