Hi-
Is it possible to get introspection information out of Guile
(preferably without having to load GOOPS)?
For example, how can I write a function that prints its own name?
You can define a macro to make this happen:
(defmacro define-named (name-and-args . body)
(let ((name (car name-and-args))
(args (cdr name-and-args)))
`(define (,name ,@args)
(let ((--function-- ',name))
,@body))))
Here is an example of how to use it, analogous to using __FUNCTION__ in gcc:
(define-named (some-fun)
(display --function--)
(newline))
Or, what is the scheme version of the following C code
printf("%s %d\n", __FILE__, __LINE__);
I don't know if there's a way to do this in Guile.
Issac