[racket] ] Converting symbols to procedures?

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Mon Aug 11 12:20:20 EDT 2014

Quoting is not a synonym for creating lists.
For example:
(define foo (lambda (x y z) (printf "~a ~a~%" x z) y))
foo => #<procedure>
'foo => 'foo

If you want to write, say,

(list (foo 'arg0 1 #f) (bar 'arg0 1 #f) (baz 'arg0 1 #f))
as
(apply* (list foo bar baz) '(arg0 1 #f))

where
(define (apply* ps vs)
  (if (pair? ps)
      (cons (apply (car ps) vs) (apply* (cdr ps) vs))
      '()))

then you have to use list and refer to the /bindings/ of the /identifiers/ foo, bar and baz. Symbols can be mucked around with as identifiers using eval, but that is almost always not the right thing to do.
-Ian
----- Original Message -----
From: "Kevin Forchione" <lysseus at gmail.com>
To: "Racket Users" <users at racket-lang.org>
Sent: Monday, August 11, 2014 12:05:20 PM GMT -05:00 US/Canada Eastern
Subject: [racket] ] Converting symbols to procedures?

If I use apply on a list of procedures, the quoting of the list converts the procedures into symbols, which is not what I want to pass to the function supplied to apply (or to map for that matter). What’s the best way to handle this situation?

-Kevin

	
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Posted on the users mailing list.