This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(ice-9 ls) patch


hello,

the patch appended below allows (ice-9 ls) procedures `ls' and `lls' to
handle invocation w/ no args.  currently, such invocation returns #f,
not very useful.  now, when invoked w/ no args, `(current-module)' is
consulted.  i've also updated the header comment, which omitted mention
of `lls' for some reason.

here is a simple change log entry:

(ls, lls): Handle no arguments as meaning to look in `(current-module)'.

thi


----------------------------
Index: ls.scm
===================================================================
RCS file: /cvs/guile/guile/guile-core/ice-9/ls.scm,v
retrieving revision 1.3
diff -c -p -w -c -r1.3 ls.scm
*** ls.scm	1997/10/23 05:01:12	1.3
--- ls.scm	1999/06/17 06:38:10
***************
*** 1,6 ****
  ;;;; ls.scm --- functions for browsing modules
  ;;;;
! ;;;; 	Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
  ;;;; 
  ;;;; This program is free software; you can redistribute it and/or modify
  ;;;; it under the terms of the GNU General Public License as published by
--- 1,6 ----
  ;;;; ls.scm --- functions for browsing modules
  ;;;;
! ;;;; 	Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
  ;;;;
  ;;;; This program is free software; you can redistribute it and/or modify
  ;;;; it under the terms of the GNU General Public License as published by
***************
*** 35,40 ****
--- 35,43 ----
  ;;;
  ;;;	ls . various-names
  ;;;
+ ;;;		With no arguments, return a list of definitions in
+ ;;;		`(current-module)'.
+ ;;;
  ;;;		With just one argument, interpret that argument as the
  ;;;		name of a subdirectory of the current module and
  ;;;		return a list of names defined there.
***************
*** 45,50 ****
--- 48,56 ----
  ;;;			 (<subdir-name> . <names-defined-there>)
  ;;;			 ...)
  ;;;
+ ;;;     lls . various-names
+ ;;;
+ ;;;		Analogous to `ls', but with local definitions only.
  
  (define-public (local-definitions-in root names)
    (let ((m (nested-ref root names))
***************
*** 64,85 ****
  			   (module-uses m)))))))
  
  (define-public (ls . various-refs)
!   (and (pair? various-refs)
         (if (cdr various-refs)
  	   (map (lambda (ref)
  		  (cons ref (definitions-in (current-module) ref)))
  		various-refs)
! 	   (definitions-in (current-module) (car various-refs)))))
  
  (define-public (lls . various-refs)
!   (and (pair? various-refs)
         (if (cdr various-refs)
  	   (map (lambda (ref)
  		  (cons ref (local-definitions-in (current-module) ref)))
  		various-refs)
! 	   (local-definitions-in (current-module) (car various-refs)))))
  
  (define-public (recursive-local-define name value)
    (let ((parent (reverse! (cdr (reverse name)))))
      (and parent (make-modules-in (current-module) parent))
      (local-define name value)))
--- 70,95 ----
  			   (module-uses m)))))))
  
  (define-public (ls . various-refs)
!   (if (pair? various-refs)
        (if (cdr various-refs)
  	  (map (lambda (ref)
  		 (cons ref (definitions-in (current-module) ref)))
  	       various-refs)
! 	  (definitions-in (current-module) (car various-refs)))
!       (definitions-in (current-module) '())))
  
  (define-public (lls . various-refs)
!   (if (pair? various-refs)
        (if (cdr various-refs)
  	  (map (lambda (ref)
  		 (cons ref (local-definitions-in (current-module) ref)))
  	       various-refs)
! 	  (local-definitions-in (current-module) (car various-refs)))
!       (local-definitions-in (current-module) '())))
  
  (define-public (recursive-local-define name value)
    (let ((parent (reverse! (cdr (reverse name)))))
      (and parent (make-modules-in (current-module) parent))
      (local-define name value)))
+ 
+ ;;; ls.scm ends here

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]