guile-devel
[Top][All Lists]
Advanced

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

[PATCH] Add inspection command "source (,src)" which shows Scheme code o


From: Nala Ginrut
Subject: [PATCH] Add inspection command "source (,src)" which shows Scheme code of loaded module
Date: Sat, 30 Mar 2013 21:57:40 +0800

Attached patch added an inspection command "source" to display the
Scheme code of loaded module, it'll be useful for folks:

-------------Scheme proc------------
scheme@(guile-user)> ,use (srfi srfi-1)
scheme@(guile-user)> ,src any
(define (any pred ls . lists)
  (check-arg procedure? pred any)
  (if (null? lists)
    (any1 pred ls)
    (let lp ((lists (cons ls lists)))
      (cond ((any1 null? lists) #f)
            ((any1 null? (map cdr lists))
             (apply pred (map car lists)))
            (else
             (or (apply pred (map car lists))
                 (lp (map cdr lists))))))))
--------------------end-------------------------


C implemented proc will give a notion.
-------------------cut------------
scheme@(guile-user)> ,src read
"It's inner procedure implemented with C"
-------------------end------------------------


proc defined in REPL shows nothing.
-----------------cut-----------
scheme@(guile-user)> (define (func) 1)
scheme@(guile-user)> ,src func
-----------------end-----------

non-proc shows nothing.
--------------cut------------------
scheme@(guile-user)> (define a 1)
scheme@(guile-user)> ,src a
--------------end------------------


Happy hacking!

Attachment: 0001-Add-src-command-in-REPL-to-show-Scheme-code-of-loade.patch
Description: Text Data


reply via email to

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