common-lisp-study/break-and-error.lisp

24 lines
1000 B
Common Lisp

(defun analyze-profit (price comission-rate)
(let* ((comission (* price comission-rate))
(result (cond ((> 100 comission) 'rich)
((< 100 comission) 'poor))))
(break "~&The value of result is ~S" result)
(format t "~&I predict that you will be: ~S" result)
result))
(analyze-profit 2200 0.06)
(analyze-profit 2000 0.05)
;;; So - debugger keys and functions
;; C-j and C-k are for moving between frames
;; for frame context commands R - return from frame with particular value (sly-db-return-from-frame)
;; x - step over, s - step
;; e - eval in frame, i - inspect in frame (show additional info on evaluated value)
;; RET - toggle details for current frame
;; v - show frames code
;; d - pretty-print-eval-in-frame
;; (searching all of functions by going into debugger bugger and looking at *helpful* (C-h C-f) "sly-db-"
;; could also try to recompile thing, maybe r for restart, or R to return with value 1 from last frame and check how it all works