Slimv: Evaluation aborted on <unknown reason>

71 Views Asked by At

I'm debugging the following mit-scheme program through vim with the assistance of slimv.

(define (pascal x)
  (define (pascal-iter m n max-len)
    (cond ((and (> m 0) (> n 0))
             (pascal-iter m (- n 1) max-len)       
             (beauti-print (pascal-item m n) max-len))
          ((= n 0) (pascal-iter (- m 1) (- m 1) max-len)
                   (display "\n")
                   (print-space (* (- x m) max-len)))
          ((= m 0) "Done")))
  (define (pascal-item m n)
    (cond ((= n 1) 1)
          ((= n m) 1)
          (else (+ (pascal-item (- m 1) (- n 1))
                   (pascal-item (- m 1) n)))))
  (define (beauti-print item max-len)
    (print-space (floor (- max-len
                       (/ (num-of-digit item) 2))))
    (display item)
    (print-space (ceiling (- max-len
                         (/ (num-of-digit item) 2)))))
  (define (num-of-digit n)
    (+ (floor (/ (log n) (log 10))) 1) )
  ;; (print-space 1)   -> " "
  ;; (print-space 1.5) -> "  "
  (define (print-space n)
    (cond ((> n 0) (display " ")
                (print-space (- n 1)))
          (else (display ""))))
  (pascal-iter x x (num-of-digit (pascal-item x (/ x 2)))))

(pascal 10)

When I ran the command :!mit-scheme --load "pascal.scm", a pascal triangle is printed on the screen, so there I can't spot any bug in my program. However, when I executed ,d and tried to run this program in slimv's REPL buffer, I got:

(user)> (pascal 10)
; Evaluation aborted on <unknown reason>
(user)> (+ 40 2) ;; other statements are interpreted as expected
42
(user)> 

So, what's the <unknown reason> that prevents my program from running properly? Is it my fault, or a bug of slimv?

This is the relevant part of swank.log:

[-Received-] 0.481893
(:return (:abort "<unknown reason>") 8)
[Actionlist] 0.482347
8: finished :listener-eval 
[---Sent---] 0.525237
(:emacs-rex (swank-repl:listener-eval "(pascal 12)
") "(user)" :repl-thread 9)
0

There are 0 best solutions below