You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When clicking, the printing doesn't seem to finish correctly, e.g. for this snippet:
(defun hello-private (body)
"Create a div on new pages containing - hello world
That when clicked changes color."
(set-on-click (create-div body :content "hello world")
(lambda (obj)
(setf (color obj) (progn
(terpri)
(princ "Setting color to:")
(print (rgb (random 255)
(random 255)
(random 255))))))))
Instead of
Setting color to:
"rgb(...)"
Setting color to:
"rgb(...)"
Setting color to:
"rgb(...)"
I get
Setting color to:
"rgb(...)"
Setting color to:
"rgb(...)"
Setting color to:
(empty lines added for clarity)
Since I could not imagine that I found a bug in progn, I searched the web for a while and found a similar problem and answer.
Adding (finish-output) to the function fixes the problem:
(defun hello-private (body)
"Create a div on new pages containing - hello world
That when clicked changes color."
(set-on-click (create-div body :content "hello world")
(lambda (obj)
(setf (color obj) (progn
(terpri)
(princ "Setting color to:")
(print (rgb (random 255)
(random 255)
(random 255)))
(finish-output))))))
The same applies to the next variation of hello-private:
(defun hello-private (body)
"Create a div on new pages containing - hello world
That when clicked changes color."
(set-on-click (create-div body :content "CLICK ME TO PLAY")
(lambda (obj)
(setf (color obj) (cond ((equal (random 10) 1)
(setf (text obj) "--(O)-(O)--")
(print "RED LIGHT!")
(finish-output)
(rgb 255 0 0))
(t
(setf (text obj) "--(X)-(X)--")
(print "I'm not looking..")
(finish-output)
(rgb 0
(random 255)
(random 255))))))))
The text was updated successfully, but these errors were encountered:
When clicking, the printing doesn't seem to finish correctly, e.g. for this snippet:
Instead of
I get
(empty lines added for clarity)
Since I could not imagine that I found a bug in
progn
, I searched the web for a while and found a similar problem and answer.Adding
(finish-output)
to the function fixes the problem:The same applies to the next variation of
hello-private
:The text was updated successfully, but these errors were encountered: