From 483ad99aca0c624a61912e7c23f711b9b7fe5c8c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 10 Oct 2020 00:03:58 -0700 Subject: 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. --- eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eval.c b/eval.c index 986f0b37..e5f08407 100644 --- a/eval.c +++ b/eval.c @@ -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; } -- cgit v1.2.3