diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-06-20 06:35:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-06-20 06:35:43 -0700 |
commit | 9a19796dfbfcce1aa425e0bcd47881b8a3089423 (patch) | |
tree | 8e6d12db35e1655ee0f594f5116cd4336a057a97 | |
parent | 4bedd6056cc59f7194ae4eede97b4c460275fcc8 (diff) | |
download | txr-9a19796dfbfcce1aa425e0bcd47881b8a3089423.tar.gz txr-9a19796dfbfcce1aa425e0bcd47881b8a3089423.tar.bz2 txr-9a19796dfbfcce1aa425e0bcd47881b8a3089423.zip |
* eval.c (eval_init): Register have function, synonym of true.
* txr.1: Document have.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | eval.c | 5 | ||||
-rw-r--r-- | txr.1 | 21 |
3 files changed, 29 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2015-06-20 Kaz Kylheku <kaz@kylheku.com> + + * eval.c (eval_init): Register have function, synonym of true. + + * txr.1: Document have. + 2015-06-19 Kaz Kylheku <kaz@kylheku.com> * txr.1: Documented ifa. @@ -3865,6 +3865,8 @@ static val merge_wrap(val seq1, val seq2, val lessfun, val keyfun) void eval_init(void) { + val not_null_f = func_n1(not_null); + protect(&top_vb, &top_fb, &top_mb, &top_smb, &special, &builtin, &dyn_env, &op_table, &last_form_evaled, &last_form_expanded, &call_f, convert(val *, 0)); @@ -4084,7 +4086,8 @@ void eval_init(void) reg_fun(intern(lit("atom"), user_package), func_n1(atom)); reg_fun(intern(lit("null"), user_package), null_f); reg_fun(intern(lit("false"), user_package), null_f); - reg_fun(intern(lit("true"), user_package), func_n1(not_null)); + reg_fun(intern(lit("true"), user_package), not_null_f); + reg_fun(intern(lit("have"), user_package), not_null_f); reg_fun(not_s, null_f); reg_fun(intern(lit("consp"), user_package), func_n1(consp)); reg_fun(intern(lit("lconsp"), user_package), func_n1(lconsp)); @@ -12993,9 +12993,10 @@ otherwise. (format t "list ~s does not contain the symbol a\en"))) .cble -.coNP Function @ true +.coNP Functions @ true and @ have .synb .mets (true << value ) +.mets (have << value ) .syne .desc @@ -13006,7 +13007,10 @@ function is the complement of the .code not and .code false -functions. +functions. The +.code have +function is a synonym for +.codn true . It return .code t @@ -13026,6 +13030,19 @@ For instance .code (if x ...) should be favored over .codn (if (true x) ...) . +However, the latter is useful with the +.code ifa +macro because +.meti (ifa (true << expr ) ...) +binds the +.code it +variable to the value of +.metn expr , +no matter what kind of form +.meta expr +is, which is not true in the +.meti (ifa < expr ...) +form. .TP* Example: .cblk |