[Openmcl-devel] Scribble demo

Ron Garret ron at awun.net
Thu Jun 4 18:17:06 UTC 2009


Yes.  Try this:

(defun foo () (print "Calling foo") 1)

(let ((x (foo)))
   (defun baz1 () x))

(defun baz2 ()
   (let ((x (foo)))
     x))

Then compare what happens when you call BAZ1 and BAZ2.

And if you want to take a deep dive, read:

http://www.flownet.com/ron/specials.pdf

rg

On Jun 4, 2009, at 10:49 AM, Neil Baylis wrote:

> Maybe this is just a stylistic thing, or maybe something else I  
> don't understand. In the scribble demo, there's a function "label'  
> that just draws the label box inside the window.
>
> Why is it defined like this:
>
> (let* ((path (make-instance ns:ns-bezier-path)))
>   (#/moveToPoint: path (ns:make-ns-point 10 10))
>   (#/lineToPoint: path (ns:make-ns-point 10 40))
>   (#/lineToPoint: path (ns:make-ns-point 90 40))
>   (#/lineToPoint: path (ns:make-ns-point 90 10))
>   (#/lineToPoint: path (ns:make-ns-point 10 10))
>   (defun label (v)
>     (#/drawAtPoint:withAttributes: #@"Scribble" (ns:make-ns-point 15  
> 15) +null-ptr+)
>     (#/stroke path)))
>
>
> Instead of like this:
>
> (defun label (v)
>   (let* ((path (make-instance ns:ns-bezier-path)))
>     (#/moveToPoint: path (ns:make-ns-point 10 10))
>     (#/lineToPoint: path (ns:make-ns-point 10 40))
>     (#/lineToPoint: path (ns:make-ns-point 90 40))
>     (#/lineToPoint: path (ns:make-ns-point 90 10))
>     (#/lineToPoint: path (ns:make-ns-point 10 10))
>     (#/fill path)
>     (#/drawAtPoint:withAttributes: #@"Scribble" (ns:make-ns-point 15  
> 15) +null-ptr+)
>     (#/stroke path)))
>
>
> Does putting the defun inside the let do something different than  
> putting the let inside the defun?
>
> Neil
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20090604/c3ddf171/attachment.html>


More information about the Openmcl-devel mailing list