[plt-scheme] cannot get mapping over procedures (procedure applications) to work

From: keydana at gmx.de (keydana at gmx.de)
Date: Mon Apr 27 11:16:39 EDT 2009

Hi all,

this seems like a horribly stupid thing to ask, but I have problems to  
map over procedures (in order to apply them). When I try

(map (lambda (fun) (fun 1 2)) '(* +))

I get

"procedure application: expected procedure, given: *; arguments were:  
1 2"

Am I overlooking something, or is it not possible to do this?

The real application should be timing several functions on the same  
input, i.e. I wrote

(define time-execs
   (lambda (fun-list count input)
      (lambda (fun)
        (printf "Timing ~s:~n" fun)
         (do ((i 0 (+ i 1)))
           ((> i count) (void))
           (fun input))))

If this can't work with map, is there another way to do it?

Thanks in advance for any help,


Posted on the users mailing list.