[plt-scheme] evaluating contents of a string
David Richards @ 2006-7-25 10:46:15 PM
"[plt-scheme] evaluating contents of a string" <mid:ac01fb5e725b12548648a10157eeb98d at verizon.net>
> Given:
> "(lambda () (current-seconds))"
> What is the 'best practice', or most elegant way to obtain a scheme
> procedure from the contents of a string?
I'd use:
(eval (read (open-input-string "(lambda () (current-seconds))")))
--
Chris Warrington <chrisw at rice.edu>
"The Ten Commandments contain 297 words. The Bill of Rights is stated
in 463 words. Lincoln's Gettysburg Address contains 266 words. A
recent federal directive to regulate the price of cabbage contains
26,911 words."
-Atlanta Journal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20060725/21e83439/attachment.sig>