I am running Emacs 24.5.1 on Windows 10 and working through SICP . The MIT Edwin editor does not work well, especially on Windows. A racket seems like a good alternative. I installed both Racket and racket-mode , and everything seems to be working fine. However, racket-mode insists on printing my results. How to get it to print in decimal?
For instance,
(require sicp) (define (square x) (* xx)) (define (average xy) (/ (+ xy) 2)) (define (improve guess x) (average guess (/ x guess))) (define (good-enough? guess x) (< (abs (- (square guess) x)) 0.001)) (define (sqrt-iter guess x) (if (good-enough? guess x) guess (sqrt-iter (improve guess x) x)))
This gives results such as
> (sqrt-iter 1 2) 577/408
A lot of documentation appears when I google the terms "Racket" and "pretty-print", but I was unlucky in realizing it. The Racket documentation seems to control pretty-printed information with some variable starting with "pretty-print". However, nothing starts with racket- or pretty inside Mx . Perhaps the shape of the fraction is not what Racket considers pretty-printed?
source share