diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-02-19 01:07:31 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-02-19 01:07:31 -0800 |
commit | d41a04ccef6e3a511582bd0e25721649d476b2d4 (patch) | |
tree | 81e18fc8bf8748b537acd4f1680027543380fab8 /match.c | |
parent | 056107ff44d2ae75b7b7db98979d1a920a37d439 (diff) | |
download | txr-d41a04ccef6e3a511582bd0e25721649d476b2d4.tar.gz txr-d41a04ccef6e3a511582bd0e25721649d476b2d4.tar.bz2 txr-d41a04ccef6e3a511582bd0e25721649d476b2d4.zip |
* lib.c (sub, ref, replace): New functions.
* lib.h (sub, ref, replace): Declared.
* match.c (format_field): Generic indexing using new functions.
* txr.1: Documentation stub.
* txr.vim: Highlighting for new functions.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -1236,16 +1236,11 @@ val format_field(val obj, val modifier, val filter, val eval_fun) val from = funcall1(eval_fun, second(arg_expr)); val to = funcall1(eval_fun, third(arg_expr)); - obj = if3((vectorp(obj)), - sub_vec(obj, from, to), - sub_list(obj, from, to)); + obj = sub(obj, from, to); } else { val arg = funcall1(eval_fun, arg_expr); if (bignump(arg) || fixnump(arg)) { - if (vectorp(obj)) - obj = vecref(obj, arg); - else - obj = listref(obj, arg); + obj = ref(obj, arg); } else { uw_throwf(query_error_s, lit("format_field: bad index: ~s"), arg, nao); |