<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Steve,</p>
<p>maybe I can help.</p>
<p><br>
##decompile retrieve the source code of a procedure (if
available):</p>
<p>> (##decompile (##lambda () test))<br>
(lambda () test)</p>
<p>If you change the name-space with:<br>
</p>
> (namespace ("test-namespace#"))<br>
<br>
decompile yields:<br>
<br>
> (##decompile (##lambda () test))<br>
(lambda () test-namespace#test)<br>
<br>
That means you have to strip the symbol suffix `test`<br>
to get the name-space.<br>
<br>
If you use the empty symbol, denoted by ||, you get the name-space<br>
symbol directly:<br>
<br>
> (##decompile (##lambda () ||)) <br>
(lambda () test-namespace#)<br>
<br>
With this information, one can define the following macro:<br>
<br>
> (define-macro (##current-namespace) (##symbol->string (eval
(##quote (##caddr (##decompile (##lambda () ||))))))) <br>
<br>
For e newly started gsi you get:<br>
<br>
>
(##current-namespace)
<br>
""<br>
<br>
If you change the name-space you get:<br>
<br>
> (namespace ("test-namespace#"))<br>
>
(##current-namespace)
<br>
"test-namespace#"<br>
<br>
<br>
HTH,<br>
<br>
Gerald<br>
<br>
<br>
<div class="moz-cite-prefix">Am 28.07.2016 um 19:12 schrieb Steve
Graham:<br>
</div>
<blockquote
cite="mid:2046641494.5749544.1469725940032.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<pre wrap="">Marc,
Could you explain this a bit?
Thanks, Steve
From: Marc Feeley <a class="moz-txt-link-rfc2396E" href="mailto:feeley@iro.umontreal.ca"><feeley@iro.umontreal.ca></a>
To: Duncan Watts <a class="moz-txt-link-rfc2396E" href="mailto:djmwatts@gmail.com"><djmwatts@gmail.com></a>
Cc: <a class="moz-txt-link-abbreviated" 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 wrap="">On Jul 28, 2016, at 12:09 PM, Duncan Watts <a class="moz-txt-link-rfc2396E" 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 class="moz-txt-link-abbreviated" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a class="moz-txt-link-freetext" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
</blockquote>
<pre wrap="">
_______________________________________________
Gambit-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a class="moz-txt-link-freetext" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Gambit-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a class="moz-txt-link-freetext" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
</blockquote>
<br>
</body>
</html>