[racket] Is eval very slow?
Hi,
I've written some code that uses eval:
(define ops (list * / + -))
(define digits '(1 2 3 4 5))
(for ([dl (combinations 4 digits)])
(define lst '())
(for ([d (permute-all dl)])
(for* ([o1 ops] [o2 ops] [o3 ops])
(unless (and (eq? o1 /) (zero? (eval (list o2 (second d) (list o3
(third d) (fourth d)))))) ; avoid divide by zero
(define val (eval (list o1 (first d) (list o2 (second d) (list o3
(third d) (fourth d))))))
(when (>= val 1) (set! lst (cons val lst)))) ...
It runs very, very slowly. Am I doing something wrong? Is there a way to
speed up eval?
Thanks,
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120718/d1e0a4bc/attachment.html>