[Openmcl-devel] tagbody and go

Taoufik Dachraoui dachraoui.taoufik at gmail.com
Wed Dec 8 09:11:21 PST 2010


I did use eval to solve this as follows:

(defmacro runstep (step)
   `(tagbody (go ,step)
       1 (format t "run 1~%") (go end)
       2 (format t "run 2~%") (go end)
       3 (format t "run 3~%") (go end)
       4 (format t "run 4~%") (go end)
       5 (format t "run 5~%") (go end)
     end ))

(let ((step 3)) (eval `(runstep ,step))

but I thought that the above  eval will expand runstep
then I choose to create another macro

(defmacro gostep (step) `(runstep ,step))

(let ((step 3)) (eval `(gostep ,step)))

But I do not know what happens when eval is called (when the macros
are expanded).

My objective is to go to a given step directly in constant time

Kind regards
Taoufik

My intention is to

On Wed, Dec 8, 2010 at 5:37 PM, Pascal Costanza <pc at p-cos.net> wrote:

>
> On 8 Dec 2010, at 17:36, Taoufik Dachraoui wrote:
>
> > Hi
> >
> > I would like to implement something like the following:
> >
> > (defun runstep (step)
> >    (tagbody (go step)
> >        1 (format t "run 1~%") (go end)
> >        2 (format t "run 2~%") (go end)
> >        3 (format t "run 3~%") (go end)
> >        4 (format t "run 4~%") (go end)
> >        5 (format t "run 5~%") (go end)
> >      end ))
> >
> > this does not work, but how can I do something like this?
>
> (defun runstep (step)
>  (ecase step
>     (1 ...)
>     (2 ...)
>     (3 ...)))
>
>
> Pascal
>
> --
> Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
> Vrije Universiteit Brussel
> Software Languages Lab
> Pleinlaan 2, B-1050 Brussel, Belgium
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20101208/2a37f29d/attachment.htm>


More information about the Openmcl-devel mailing list