Closed aykaramba closed 10 months ago
The problem is not with incf
but with the return value of let
. You create a pen with :fill
being equal to a number - 0.02
, which causes an error when trying to draw something.
Aha! You are correct, and I am dumb. For anyone reading this, the updated code is the same, I just changed the order of forms as the let returns the last form in the body:
(dotimes (x 10)
(dotimes (y 10)
(with-pen (make-pen :fill (let ((x 0.01))
(incf x 0.01))
(rgb x x x)
:stroke (gray 0.2)
:weight 11)
(rect (* x 80) (* y 80) 80 80))))
thanks Gleefre for the tip!
In common lisp, we are allowed to incf in a let form as per these examples (link: https://jtra.cz/stuff/lisp/sclr/incf.html):
However, when I have a let form in Sketch and I incf a lexically scoped variable, I get the following error:
The code:
Does anyone know why the (incf) in the let triggers the unsigned-byte 32 error?