Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Please excuse the really contrived example, but you can do this in Gambit:

    ~ cat do-it.scm
  (define (do-it x)
    (if (> x 0)
        x
        'error))
  
  (define (do-it-fixed x)
    (if (and (number? x) (> x 0))
        x
        'error))
  ~ gsi do-it.scm -
  > (do-it (do-it 0))
  *** ERROR IN do-it, "do-it.scm"@2.7 -- (Argument 2) REAL expected
  (> 'error 0)
  1> ,b
  0  do-it                   "do-it.scm"@2:7         (> x 0)
  1  (interaction)           (stdin)@1:1             (do-it (do-it 0))
  2  ##main                  
  1> ,e
  x = 'error
  1> (set! do-it do-it-fixed) 
  1> ,(c x)
  error
  > (do-it (do-it 0))
  error
Per the Gambit docs[1], "The nested REPL’s continuation and evaluation environment are the same as the point where the evaluation was stopped.". The call to ,(c x) is really just calling the reified continuation c with argument x.

[1]: https://gambitscheme.org/latest/manual/#Debugging



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: