How to debug an eval...

For the Compleat Fan

How to debug an eval...

Postby hartrock » Sat Sep 12, 2015 9:13 am

There is:
Code: Select all
> (define (foo) (println "foo" (+ 1 2)))
(lambda () (println "foo" (+ 1 2)))
> (trace true) (foo)
true

-----

(define (foo )
  #(println "foo" (+ 1 2))#)


[-> 2 ] s|tep n|ext c|ont q|uit >
; but there also is:
Code: Select all
> (define (foo) (println "foo" (+ 1 2)))
(lambda () (println "foo" (+ 1 2)))
> (trace true) ((eval 'foo))
true
foo3
3
0 >
How to go into debug mode for eval?
There is a solution:
Code: Select all
> (define (foo) (println "foo" (+ 1 2)))
(lambda () (println "foo" (+ 1 2)))
> (define (w aSym) (trace true) (set 't (eval aSym)) (t))
(lambda (aSym) (trace true) (set 't (eval aSym)) (t))
> (w 'foo)

-----

(define (t )
  #(println "foo" (+ 1 2))#)


[-> 3 ] s|tep n|ext c|ont q|uit >

In addition it may be needed to store argument expressions of a func into temp vars, and calling it with them, instead of evaluating expressions in arg postions.
hartrock
 
Posts: 136
Joined: Wed Aug 07, 2013 9:37 pm

Return to Anything else we might add?

Who is online

Users browsing this forum: No registered users and 1 guest