Allegro CL, Debugging functions step by step

180 Views Asked by At

I am trying to understand how a function works in Lisp, I used Allegro Cl quite some time ago, and I remember it had a special function in the REPL, that let you see how a function worked step by step, like in Matlab. For example, if you had this function:

(+ 1
   (* 2 3
      (/ 6 2)
    ) 
)

You could see each function step by step, like:

(+ 1
   (* 2 3
      3)
)

And then:

(+ 1
   18)

And finally:

19

Many thanks in advance.

1

There are 1 best solutions below

0
On

Thanks to jkiiski,

The code for showing step by step the function would be:

(step (+ 1 (* 2 3 (/ 6 2))))

and this shows in very detail how Lisp parses all the data and evaluates the function.

After many steps it gives:

[STEP] CG-USER(2): 
   result 6: 2
  6: (/ 6 2)
[STEP] CG-USER(2): 
    result 5: 18
   result 4: 18
  result 3: 18
 result 2: 18
2: (+ 1 18)
[STEP] CG-USER(2): 
 result 2: 19
result 1: 19