<rant>
(andmap f xs) tries to be clever by returning (f <last-element>) in tail position.
But this is kinda bad, because it doesn’t generalize to other constructs. For example:
(for/and ([x xs] #:when (pred x))
(f x)) In an iteration, for/and can compute (f x). But it can’t ever return (f x) in tail position because it needs to look into the next iterations whether (pred x) are all #f.
</rant>
is there a situation where the tail-position-ness mattered to you? wondering how this came up
It’s just inconsistent.
> (andmap (lambda (x) (values 1 2)) '(1))
1
2
> (for/and ([x (in-list '(1))])
(values 1 2))
error
the second behavior seems more sensible to me
Yeah
I think the idea of that behavior is that (andmap f (list 1 2 3)) is supposed to be like (and (f 1) (f 2) (f 3))
and (and #t (values 1 2)) results in (values 1 2) which is kinda useful as a control flow operator.