> On Feb 18, 2017, at 7:53 AM, Amirouche <amirou...@hypermove.net> wrote:
> Le 18/02/2017 à 16:50, Amirouche a écrit :
>> Le 18/02/2017 à 01:13, Matt Wette a écrit :
>>> (use-modules (system repl repl))
>>> (use-modules (system repl debug))
>>> 
>>> (define-syntax-rule (trap-here)
>>>   (start-repl
>>>    #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t)))
>>> 
>>> (define (foo)
>>>   (let iter ((sum 0) (vals '(1 2 3 5 8 2)))
>>>     (trap-here)
>>>     (if (null? vals) sum
>>>    (iter (+ sum (car vals)) (cdr vals)))))
>>> 
>>> (foo)
>> It looks like that. Except `iter` should be defined in the namespace of the 
>> REPL.
> Maybe iter is complicated, but at least sum and vals.

Hmm.   The procedure “foo” without the "(trap-here)” is just a simple program 
(using named let) that I want to debug. 
So I add the “(trap-here)” to get into the debugger at that spot in the 
program, like I would add “pdb.set_trace()” in python.

Matt


Reply via email to