Re: Guile Introspection

2007-07-10 Thread Marco Maggi
"Mike Gran" wrote:
>what is the scheme version of the following C code
>
>printf("%s %d\n", __FILE__, __LINE__);

A better solution[1] than the other I posted. Still far
from perfect.

[1]


--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"



___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: current module fluid

2007-07-10 Thread Ludovic Courtès
Hi Jon,

Jon Wilson <[EMAIL PROTECTED]> writes:

> Thanks for the swift reply.  However, I meant to ask whether or not
> the fluid "the_module" is accessible from scheme as a fluid.

Ah sorry.  Then the answer is "no".

Then indeed, you have to go through `dynamic-wind'.  Arguably, this is
not very convenient, but it's been this way for very long.

OTOH, you have `save-module-excursion' which takes a thunk and does what
you want.  You could write:

  (define (load-with-env file env)
(save-module-excursion
  (lambda ()
(set-current-module env)
(load file

And no, it's not documented (patch welcome! ;-)).

Thanks,
Ludovic.




___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: current module fluid

2007-07-10 Thread Jon Wilson

Hi Ludovic,
Thanks for the suggestion.  I likely never would have found 
save-module-excursion on my own.


Ludovic Courtès wrote:

And no, it's not documented (patch welcome! ;-)).
  

Here we are: (attached)

Regards,
Jon

Index: api-modules.texi
===
RCS file: /sources/guile/guile/guile-core/doc/ref/api-modules.texi,v
retrieving revision 1.16
diff -r1.16 api-modules.texi
604a605,616
> @deffn {Scheme Procedure} save-module-excursion thunk
> Allows you to change the current module temporarily in a continuation-safe
> manner.  Presumably, you will call @code{set-current-module} within @var{thunk}.
> 
> Call @var{thunk} within a @code{dynamic-wind}.  If @var{thunk} escapes non-locally,
> the current module (at the time of escape) is saved, and the original
> current module (at the time @var{thunk}'s dynamic extent was last entered)
> is restored.  If @var{thunk}'s dynamic extent is re-entered, then the
> current module is saved, and the previously saved inner module is set
> current again.
> @end deffn
> 

___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: undocumented bound symbols

2007-07-10 Thread Ludovic Courtès
Hi,

Jon Wilson <[EMAIL PROTECTED]> writes:

> In the interest of getting things started, I took care of one of the
> easy ones.  I checked out the latest from CVS HEAD, and added both
> "1+" and "1-" to the manual there.

I committed something similar, thanks!

Note that most of the other undocumented symbols you listed are either
from RnRS or some SRFI.

Thanks,
Ludovic.



___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: undocumented bound symbols

2007-07-10 Thread Jon Wilson

Hi Ludovic,
Thanks for committing my patch.

Ludovic Courtès wrote:

Note that most of the other undocumented symbols you listed are either
from RnRS or some SRFI.
  
It has been just long enough now that I don't remember exactly what I 
did.  I do recall that I took all r5rs symbols (that were listed in 
guile manual's r5rs index, that is) out of the undocumented list.  True 
I didn't think about r4rs, r3rs, etc.  The only srfis that should have 
been loaded were those loaded by guile's core and those (if any?) needed 
for (ice-9 readline).  And aren't all of guile's implemented srfis 
documented in the manual (and thus their symbols in one of the 
indices)?  If not, well, they should be, or else none of them (guile 
implemented srfis) should be, it seems.


Regards,
Jon



___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user