Changing printing of rationals
Unable to parse email body. Email id is 6365
Unable to parse email body. Email id is 6365
> So I'm wondering whether there is a way (ideally portable, but I can live with > Lispworks-specific) to change printing of rationals? It's for interactive > development use only, although I'd probably choose an output format allowing me > to read the printed values back in correctly just in case I want use output for > input (say §R[36314/6525:5.56536])... You could mess around with the pretty print dispatch tables. Example. (defparameter *my-dispatch* (copy-pprint-dispatch nil)) (set-pprint-dispatch 'ratio #'(lambda (stream object) (format stream "§R[~A/~A ~A]" (numerator object) (denominator object) (float object))) 0 *my-dispatch*) (let ((*print-pprint-dispatch* *my-dispatch*)) (pprint 1/2)) => §R[1/2 0.5] Sean.