<div dir="ltr">Hi<div><br></div><div>Thank you for the reply</div><div><br></div><div>I cannot use T or NIL in the following case:</div><div><br></div><div>I have a file match.lisp as the following:</div><div><br></div><div>
;;; file match.lisp</div><div>@::use (common-lisp)</div><div><br></div><div>(defun match-destruc (...)</div><div>   ....</div><div>     ((eq pat '_)  ...)</div><div>  ....)</div><div><br></div><div>@::public</div><div>
(defmacro match (...)</div><div>   ... (match-destruc ...)</div><div>   ...)</div><div>;;; end match.lisp</div><div><br></div><div>Any other file using match</div><div>;; start file example.lisp</div><div>@::use (common-lisp match)</div>
<div>....</div><div>(defun foo (expr)</div><div>   (match expr</div><div>      ((1 _) 'ok)</div><div>      ((2 _) 'ok)</div><div>       ....))</div><div><br></div><div>usage:</div><div>? (mb:use 'example)</div>
<div>? (foo '(1 hello))</div><div><br></div><div>The symbol '_ matches anything</div><div><br></div><div>The issue is that the 'EXAMPLE::_ is not equal to 'MATCH::_</div><div><br></div><div>In match-destruc I can use (string= (symbol-name pat) "_") instead of (eq pat '_)</div>
<div><br></div><div>In this case I am forced to put match-destruc in the public section (this will export all the symbols</div><div>created by the definition of function)</div><div><br></div><div><br></div><div>Kind regards</div>
<div>Taoufik</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 5, 2013 at 1:43 PM, Pascal J. Bourguignon <span dir="ltr"><<a href="mailto:pjb@informatimago.com" target="_blank">pjb@informatimago.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Taoufik Dachraoui <<a href="mailto:dachraoui.taoufik@gmail.com">dachraoui.taoufik@gmail.com</a>> writes:<br>

<br>
> Now, the issue (or annoyance) I encountered is the following:<br>
><br>
> (make-package :test1 :use :common-lisp)<br>
> (make-package :test2 :use :common-lisp)<br>
<br>
</div>This is not Common Lisp.<br>
<br>
clhs make-package:<br>
<br>
    make-package package-name &key nicknames use => package<br>
<br>
    Arguments and Values:<br>
<br>
    package-name---a string designator.<br>
<br>
    nicknames---a list of string designators. The default is the empty list.<br>
<br>
    use---a list of package designators. The default is implementation-defined.<br>
<br>
Notice the difference<br>
between "a list of package designators"<br>
    and "a designator of a list of package".<br>
<div class="im"><br>
<br>
<br>
<br>
> (in-package :test2)<br>
> (defun foo (e) (if (eq e 'azerty) 'ok))<br>
> (export 'foo)<br>
> (in-package :test1)<br>
> (use-package :test2)<br>
> ? (foo 'test2::azerty)<br>
> TEST2::OK<br>
> ? (foo 'azerty)<br>
> NIL<br>
> ? <br>
><br>
> I understand that this is how it should be. <br>
><br>
> But this poses an issue for me, because I have to use<br>
> (string= (symbol-name e) "AZERTY") in foo:<br>
><br>
> (defun foo (e) (if (string= (symbol-name e) "AZERTY") 'ok))<br>
><br>
> But then the 'ok will be returned as TEST2::OK, this means that TEST1<br>
> package has to use symbol-name and intern it<br>
><br>
> This is annoying, how do you solve this issue<br>
<br>
</div>You have at least two ways:<br>
<br>
- use keywords.<br>
- export the symbols.<br>
<br>
<br>
Also, in the case of OK, don't use OK.  Use CL:T or CL:NIL !  They're<br>
made for that (or if you really must, then use :OK).<br>
<div class="im"><br>
<br>
    (in-package :test2)<br>
    (defun foo (e) (if (eq e :azerty) :ok))<br>
    (export 'foo)<br>
    (in-package :test1)<br>
    (use-package :test2)<br>
</div>    (foo :azerty)<br>
    --> :OK<br>
<br>
or:<br>
<br>
    (in-package :test2)<br>
    (defun foo (e) (if (eq e 'azerty) T NIL))<br>
    (export '(foo azerty))<br>
    (in-package :test1)<br>
    (use-package :test2)<br>
    (foo 'azerty)<br>
    --> T<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
__Pascal Bourguignon__                     <a href="http://www.informatimago.com/" target="_blank">http://www.informatimago.com/</a><br>
A bad day in () is better than a good day in {}.<br>
<br>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
</font></span></blockquote></div><br></div>