diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-08-02 06:36:39 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-08-02 06:36:39 -0700 |
commit | 982bc4b4bc71a80761ebb9b58e4db06bc1317bb6 (patch) | |
tree | bc8798649e23167b535ef694c3c4ed599c64008f /eval.c | |
parent | c0e7cf6b08e4ee72faede72f2c57ae08904fc8f4 (diff) | |
download | txr-982bc4b4bc71a80761ebb9b58e4db06bc1317bb6.tar.gz txr-982bc4b4bc71a80761ebb9b58e4db06bc1317bb6.tar.bz2 txr-982bc4b4bc71a80761ebb9b58e4db06bc1317bb6.zip |
bugfix: spurious nils in pad function's output.
* eval.c (pad): Incoming sequence must be nullified, otherwise
empty vectors and strings produce a spurious nil.
This affects the weave function, which uses pad.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -5137,23 +5137,24 @@ static val pad_func(val env, val lcons) return nil; } -static val pad(val list, val item_in, val count) +static val pad(val seq_in, val item_in, val count) { val item = default_null_arg(item_in); + val seq = nullify(seq_in); - switch (type(list)) { + switch (type(seq)) { case NIL: return repeat(cons(item, nil), count); case CONS: - return append2(list, repeat(cons(item, nil), count)); + return append2(seq, repeat(cons(item, nil), count)); case LCONS: case VEC: case LIT: case STR: case LSTR: - return make_lazy_cons(func_f1(cons(list, cons(item, count)), pad_func)); + return make_lazy_cons(func_f1(cons(seq, cons(item, count)), pad_func)); default: - uw_throwf(error_s, lit("pad: cannot pad ~s, only sequences"), list, nao); + uw_throwf(error_s, lit("pad: cannot pad ~s, only sequences"), seq, nao); } } |