<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px"><div><span>Thanks, Gerald.  Very interesting.</span></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1469749705232_4700"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1469749705232_4656" style="display: block;">  <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1469749705232_4655"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1469749705232_4654"> <div dir="ltr" id="yui_3_16_0_ym19_1_1469749705232_4671"> <font size="2" face="Arial" id="yui_3_16_0_ym19_1_1469749705232_4670"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Gerald Klix <gambit.00@klix.ch><br> <b><span style="font-weight: bold;">To:</span></b> gambit-list@iro.umontreal.ca <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, July 28, 2016 11:00 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [gambit-list] Current namespace at the repl<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1469749705232_4653"><br><div id="yiv5171773798"><div id="yui_3_16_0_ym19_1_1469749705232_4652">
    <div id="yui_3_16_0_ym19_1_1469749705232_4651">Steve,</div>
    <div id="yui_3_16_0_ym19_1_1469749705232_4663">maybe I can help.</div>
    <div><br clear="none">
      ##decompile retrieve the source code of a procedure (if
      available):</div>
    <div>> (##decompile (##lambda () test))<br clear="none">
      (lambda () test)</div>
    <div>If you change the name-space with:<br clear="none">
    </div>
    > (namespace ("test-namespace#"))<br clear="none">
    <br clear="none">
    decompile yields:<br clear="none">
    <br clear="none">
    > (##decompile (##lambda () test))<br clear="none">
    (lambda () test-namespace#test)<br clear="none">
    <br clear="none">
    That means you have to strip the symbol suffix `test`<br clear="none">
    to get the name-space.<br clear="none">
    <br clear="none">
    If you use the empty symbol, denoted by ||, you get the name-space<br clear="none">
    symbol directly:<br clear="none">
    <br clear="none">
    > (##decompile (##lambda () ||))  <br clear="none">
    (lambda () test-namespace#)<br clear="none">
    <br clear="none">
    With this information, one can define the following macro:<br clear="none">
    <br clear="none">
    > (define-macro (##current-namespace) (##symbol->string (eval
    (##quote (##caddr (##decompile (##lambda () ||)))))))           <br clear="none">
    <br clear="none">
    For e newly started gsi you get:<br clear="none">
    <br clear="none">
    >
(##current-namespace)                                                                                         
    <br clear="none">
    ""<br clear="none">
    <br clear="none">
    If you change the name-space you get:<br clear="none">
    <br clear="none">
    > (namespace ("test-namespace#"))<br clear="none">
    >
(##current-namespace)                                                                                         
    <br clear="none">
    "test-namespace#"<br clear="none">
    <br clear="none">
    <br clear="none">
    HTH,<br clear="none">
    <br clear="none">
    Gerald<br clear="none">
    <br clear="none">
    <br clear="none">
    <div class="yiv5171773798moz-cite-prefix">Am 28.07.2016 um 19:12 schrieb Steve
      Graham:<br clear="none">
    </div>
    <blockquote type="cite">
      <pre>Marc,
   Could you explain this a bit?

Thanks, Steve

      From: Marc Feeley <a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-rfc2396E" ymailto="mailto:feeley@iro.umontreal.ca" target="_blank" href="mailto:feeley@iro.umontreal.ca"><feeley@iro.umontreal.ca></a>
 To: Duncan Watts <a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-rfc2396E" ymailto="mailto:djmwatts@gmail.com" target="_blank" href="mailto:djmwatts@gmail.com"><djmwatts@gmail.com></a> 
Cc: <a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-abbreviated" ymailto="mailto:Gambit-list@iro.umontreal.ca" target="_blank" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
 Sent: Thursday, July 28, 2016 4:22 AM
 Subject: Re: [gambit-list] Current namespace at the repl
   
A bit of a hack... Try:

(##caddr (##decompile (##lambda () ||)))

You can define a macro based on that idea.

Marc

</pre>
      <blockquote type="cite">
        <pre>On Jul 28, 2016, at 12:09 PM, Duncan Watts <a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-rfc2396E" ymailto="mailto:djmwatts@gmail.com" target="_blank" href="mailto:djmwatts@gmail.com"><djmwatts@gmail.com></a> wrote:

Is there a function (or would it be easy to access the internals to write one) to find out what the currently active namespace is at the repl. Ie after entering a few (namespace ("foo#")) expressions it would be nice to be able check what the current namespace is with eg (current-namespace) --> "foo#"

Thanks
Duncan
_______________________________________________
Gambit-list mailing list
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-abbreviated" ymailto="mailto:Gambit-list@iro.umontreal.ca" target="_blank" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-freetext" target="_blank" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
      </blockquote>
      <pre>_______________________________________________
Gambit-list mailing list
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-abbreviated" ymailto="mailto:Gambit-list@iro.umontreal.ca" target="_blank" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-freetext" target="_blank" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>


  
</pre>
      <div class="yiv5171773798yqt4120003291" id="yiv5171773798yqtfd89480"><br clear="none">
      <fieldset class="yiv5171773798mimeAttachmentHeader"></fieldset>
      <br clear="none">
      <pre>_______________________________________________
Gambit-list mailing list
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-abbreviated" ymailto="mailto:Gambit-list@iro.umontreal.ca" target="_blank" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a rel="nofollow" shape="rect" class="yiv5171773798moz-txt-link-freetext" target="_blank" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
    </div></blockquote><div class="yiv5171773798yqt4120003291" id="yiv5171773798yqtfd05311">
    <br clear="none">
  </div></div></div><br><div class="yqt4120003291" id="yqtfd12115">_______________________________________________<br clear="none">Gambit-list mailing list<br clear="none"><a shape="rect" ymailto="mailto:Gambit-list@iro.umontreal.ca" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br clear="none"><a shape="rect" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br clear="none"></div><br><br></div> </div> </div>  </div></div></body></html>