guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dumping guile's state and registering variables.


From: Martin Grabmueller
Subject: Re: Dumping guile's state and registering variables.
Date: Wed, 07 Mar 2001 17:22:30 +0100

> From: Brett Viren <address@hidden>
> Date: Wed, 7 Mar 2001 10:11:59 -0500 (EST)
> 
> I did find the guile procedure: procedure-source and wrote the
> following:

[code snipped]

For getting the source of a procedure, you may try the following
snippet (which expects `procname' to be a Scheme string containing the
name of the procedure):

  SCM proc = gh_lookup (SCM_STRING_CHARS (procname));
  SCM source = scm_procedure_source (proc);
  gh_write (proc);
  gh_newline ();
  gh_write (source);
  gh_newline ();

(of course, error checking is omitted in the example)

> This is a little tortured, because even though procedure-source
> returns a list, (list->string (procedure-source proc)) failed.  Also
> because I'm only 50% sure what I am doing....

list->string is for converting a list of characters to a string, not
list->for arbitrary lists:

guile> (list->string '(#\H #\e #\l #\l #\o))
"Hello"
guile> (list->string '(1 2 3))
ERROR: In procedure string in expression (list->string (quote #)):
ERROR: Wrong type argument (expecting CHARP): 1
ABORT: (wrong-type-arg)

Regards,
  'martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]