[Openmcl-devel] goblock
Taoufik Dachraoui
dachraoui.taoufik at gmail.com
Sat Feb 23 02:12:01 PST 2013
Hi
I needed to have a computed GO in one of my developments
I could not use tagbody so I developed a macro using
nfunctions and replace go by a funcall
in order to improve performance I use (return-from block (funcall f))
where all nfunctions have the form (lambda () (block name body))
I was hoping that the compiler will replace (return-from name (funcall f))
as a simple jump but this was not the case
Even though I found a simple implementation using tagbody
I would like to know why the compiler do not consider
(return-from block (funcall f)) as a simple jump
With the simple implementation using tagbody, as fast as the tagbody,
I can do the following:
(defun bar ()
(let ((tags '(h e l l o end))
(n 0))
(tagblock nil
start (incf n) (goto (pop tags))
end (return-from nil n)
h (princ 'h) (go start)
e (princ 'e) (go start)
l (princ 'l) (go start)
o (princ 'o) (go start)
)))
as you can see (goto expr) will compute expr and the (go <result of expr>)
Kind regards
Taoufik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20130223/2a35bd5c/attachment.htm>
More information about the Openmcl-devel
mailing list