<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Ah. That is indeed not possible with a regular macro because this syntax is fundamentally incompatible with the default Lisp reader. So while it is possible to do this using the reader, if you do, you won’t be able to read standard Lisp any more. So a better approach would be to either 1) design a better syntax or 2) write your own parser for this syntax.<div><br></div><div>Or you could just use the standard CL idiom for what it looks like you want to accomplish: (the tag expression)</div><div><br></div><div>rg<br><div><div><br><div><div>On Jul 29, 2018, at 4:25 AM, Taoufik Dachraoui <<a href="mailto:dachraoui.taoufik@gmail.com">dachraoui.taoufik@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">this does not work because any expression can be tagged and not only symbols:<div><br></div><div>(+ x 1):foo => (tag foo (+ x 1))</div><div><br></div><div>Also, how a macro can solve this? as soon as the reader sees x:foo it will complain that package x does not exist</div><div><br></div><div>Taoufik</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jul 28, 2018 at 5:36 PM Ron Garret <<a href="mailto:ron@flownet.com">ron@flownet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Yeah, doing this with a reader macro is a bad idea. But you can do it with a regular macro via something like:<div><br></div><div>`(tag ,(intern (package-name (symbol-package the-symbol)) the-current-package) ,(intern (symbol-name (the-symbol)) the-current-package))</div><div><br></div><div>rg</div><div><br><div><div>On Jul 28, 2018, at 4:54 AM, Bill St. Clair <<a href="mailto:wws@clozure.com" target="_blank">wws@clozure.com</a>> wrote:</div><br class="m_-3836519591448934634Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">As far as I know, you can’t do that. I would also recommend against redefining the package prefix separator.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jul 28, 2018 at 7:45 AM Taoufik Dachraoui <<a href="mailto:dachraoui.taoufik@gmail.com" target="_blank">dachraoui.taoufik@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I would like to be able to transform x:foo to (tag foo x)</div><div><br></div><div>if I define a macro-character for : how can I access the symbol </div><div>read just before :</div><div><br></div><div>Example of usage:</div><div><br></div><div>(fn (x:foo) (+ x 1)) => (fn ((tag foo x)) (+ x 1))</div><div>((fn (x:list) (car x)) body:list) => ((fn ((tag list x)) (car x)) (tag list body))</div><div><br></div><div>Thanks for your help</div><div><br></div><div>Taoufik</div></div>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
<a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" rel="noreferrer" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
</blockquote></div>
_______________________________________________<br>Openmcl-devel mailing list<br><a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br><a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote></div><br></div></div></blockquote></div>
</blockquote></div><br></div></div></div></body></html>