Follow up on Ben's idea:
Take n as an optional argument, init value #f.
On first application of f on the first values, continue n-map with
n=received number of values. Once arrived at the empty lists you know how
many values you should have.
At each iteration, you can even check that the number of
procedure-result-arity is very limited
if you can find a way to call `f` once, though, you could assume that
its result arity never changes
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails
I'm trying to write a generalization of map that supports multiple return
values:
(define (map-n n f ls . lss)
(if (empty? ls)
(apply values (build-list n (lambda _ '(
(call-with-values
(thunk (apply f (car ls) (map car lss)))
(lambda vs
(call-with-values
3 matches
Mail list logo