diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-10-10 00:03:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-10-10 00:03:58 -0700 |
commit | 483ad99aca0c624a61912e7c23f711b9b7fe5c8c (patch) | |
tree | e89d3dc693d177fbb59d03abb4528653517d091b | |
parent | 30ce19ab9e58fe885241bfcdbe3ae20ee2a8e1e1 (diff) | |
download | txr-483ad99aca0c624a61912e7c23f711b9b7fe5c8c.tar.gz txr-483ad99aca0c624a61912e7c23f711b9b7fe5c8c.tar.bz2 txr-483ad99aca0c624a61912e7c23f711b9b7fe5c8c.zip |
mapcar: regression: not not converting to left type
* eval.c (map_common): Save the leftmost arg in a local
variable, and refer to that in the make_like call.
The bug here is that the args get zapped to nil.
-rw-r--r-- | eval.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -5288,6 +5288,7 @@ static val map_common(val self, val fun, struct args *lists, return map_fn(fun, args_atz(lists, 0)); } else { cnum i, idx, argc = args_count(lists, self); + val arg0 = args_at(lists, 0); seq_iter_t *iter_array = coerce(seq_iter_t *, alloca(argc * sizeof *iter_array)); args_decl(args_fun, max(argc, ARGS_MIN)); @@ -5308,7 +5309,7 @@ static val map_common(val self, val fun, struct args *lists, seq_iter_t *iter = &iter_array[i]; if (!seq_get(iter, &elem)) - return collect_fn != 0 ? make_like(out, args_at(lists, 0)) : nil; + return collect_fn != 0 ? make_like(out, arg0) : nil; args_fun->arg[i] = elem; } |