我正在使用mit-scheme及其圖形庫。 你製作一個圖形設備,它打開一個圖形創建窗口。 (graphics-operation device 'set-foreground-color "black")
使線條變黑。函數(graphics-operation device 'fill-polygon #(0 1 0 0 1 0 1 1))
形成一個黑色正方形,參數#()中的每兩個數字都是該形狀上的一個點。 如果我使用以下命令:計劃圖形
(define (print-cell dev x y)
(define off .01)
(define x+ (+ x off))
(define x- (- x off))
(define y+ (+ y off))
(define y- (- y off))
(graphics-operation dev 'fill-polygon #(x+ y+ x+ y- x- y+ x- y-)))
我得到的錯誤The object x+ passed to integer->flownum is not the correct type
我不明白這一點,因爲我可以在功能#()部分使用flonums爲ARGS。
我想print-cell
採取一組座標,然後畫一個小正方形的點爲中心,使得(print-cell device .5 .5)
變成(graphics-operation device 'fill-polygon #(.51 .51 .51 .49 .49 .49 .49 .51))