joshibharathiramana
2021-6-14 11:52:51

Is there a predefined procedure that takes a list of procedures and applies them to get a list of values. Something like (define (inverted-map procs arg) (map (lambda (proc) (proc arg)) procs)) (or a generalization)


laurent.orseau
2021-6-14 12:00:17

Not really. foldl is similarly almost there, but not quite: > (foldl (λ (f acc) (f acc)) 2 (list add1 / displayln)) 1/3


ben.knoble
2021-6-14 14:43:50

Funny, I’ve ended up writing the same thing in SML a few times: fun mapp fs x = map (fn f => f x) fs fun mapps fs xs = ListPair.map (fn (f, x) => f x) (fs, xs) I use mapp as a cutesy spelling of map + app, since app is the (SML) function with signature ('a -> unit) -> 'a list -> unit


ben.knoble
2021-6-14 14:44:07

But racket could probably use something similar


ben.knoble
2021-6-14 14:44:16

And the second one should probably be zipmap or pointwise-map or …


haasis_noah
2021-6-14 19:38:12

@haasis_noah has joined the channel