1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

Update copyright.

Add commentary; nfc.
This commit is contained in:
Thien-Thi Nguyen 2002-03-28 00:21:04 +00:00
parent ead4514696
commit 0706ae06dc
3 changed files with 84 additions and 54 deletions

View file

@ -1,6 +1,6 @@
;;;; srfi-11.scm --- SRFI-11 procedures for Guile ;;;; srfi-11.scm --- SRFI-11 procedures for Guile
;;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. ;;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
;;; ;;;
;;; This program is free software; you can redistribute it and/or ;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as ;;; modify it under the terms of the GNU General Public License as
@ -41,6 +41,24 @@
;;; whether to permit this exception to apply to your modifications. ;;; whether to permit this exception to apply to your modifications.
;;; If you do not wish that, delete this exception notice. ;;; If you do not wish that, delete this exception notice.
;;; Commentary:
;; This module exports two syntax forms: let-values and let*-values.
;;
;; Sample usage:
;;
;; (let-values (((x y . z) (foo a b))
;; ((p q) (bar c)))
;; (baz x y z p q))
;;
;; This binds `x' and `y' to the first to values returned by `foo',
;; `z' to the rest of the values from `foo', and `p' and `q' to the
;; values returned by `bar'. All of these are available to `baz'.
;;
;; let*-values : let-values :: let* : let
;;; Code:
(define-module (srfi srfi-11) (define-module (srfi srfi-11)
:use-module (ice-9 syncase) :use-module (ice-9 syncase)
:export-syntax (let-values let*-values)) :export-syntax (let-values let*-values))
@ -100,7 +118,7 @@
; body ...) ; body ...)
; (lambda lambda-tmps ; (lambda lambda-tmps
; (let-values-helper "cwv" lv-bindings final-let-bindings body ...))) ; (let-values-helper "cwv" lv-bindings final-let-bindings body ...)))
; ((_ "consumer" (var-1 var-2 ...) (lambda-tmp ...) final-let-bindings lv-bindings ; ((_ "consumer" (var-1 var-2 ...) (lambda-tmp ...) final-let-bindings lv-bindings
; body ...) ; body ...)
; (let-values-helper "consumer" ; (let-values-helper "consumer"
@ -165,7 +183,7 @@
; tmp-vars ; tmp-vars
; ((vars-2 binding-2) ...) ; ((vars-2 binding-2) ...)
; body ...)))))) ; body ...))))))
; ;
; (syntax-rules () ; (syntax-rules ()
; ((_ () body ...) ; ((_ () body ...)
; (begin body ...)) ; (begin body ...))
@ -184,7 +202,7 @@
((null? elts) '()) ((null? elts) '())
((pair? elts) (cons (proc (car elts)) (map-1-dot proc (cdr elts)))) ((pair? elts) (cons (proc (car elts)) (map-1-dot proc (cdr elts))))
(else (proc elts)))) (else (proc elts))))
(define (undot-list lst) (define (undot-list lst)
;; produce a non-dotted list from a possibly dotted list. ;; produce a non-dotted list from a possibly dotted list.
(cond (cond
@ -199,7 +217,7 @@
(let-vars (map (lambda (sym tmp) (list sym tmp)) (let-vars (map (lambda (sym tmp) (list sym tmp))
(undot-list (car var-binding)) (undot-list (car var-binding))
(undot-list new-tmps)))) (undot-list new-tmps))))
(if (null? (cdr vars)) (if (null? (cdr vars))
`(call-with-values (lambda () ,(cadr var-binding)) `(call-with-values (lambda () ,(cadr var-binding))
(lambda ,new-tmps (lambda ,new-tmps
@ -209,7 +227,7 @@
(lambda ,new-tmps (lambda ,new-tmps
,(let-values-helper (cdr vars) body ,(let-values-helper (cdr vars) body
(cons let-vars prev-let-vars))))))) (cons let-vars prev-let-vars)))))))
(if (null? vars) (if (null? vars)
`(begin ,@body) `(begin ,@body)
(let-values-helper vars body '()))) (let-values-helper vars body '())))
@ -242,7 +260,7 @@
body ...)))))) body ...))))))
; Alternate define-macro implementation... ; Alternate define-macro implementation...
; ;
; (define-macro (let*-values vars . body) ; (define-macro (let*-values vars . body)
; (define (let-values-helper vars body) ; (define (let-values-helper vars body)
; (let ((var-binding (car vars))) ; (let ((var-binding (car vars)))
@ -253,7 +271,7 @@
; `(call-with-values (lambda () ,(cadr var-binding)) ; `(call-with-values (lambda () ,(cadr var-binding))
; (lambda ,(car var-binding) ; (lambda ,(car var-binding)
; ,(let-values-helper (cdr vars) body)))))) ; ,(let-values-helper (cdr vars) body))))))
; (if (null? vars) ; (if (null? vars)
; `(begin ,@body) ; `(begin ,@body)
; (let-values-helper vars body))) ; (let-values-helper vars body)))

View file

@ -1,45 +1,51 @@
;;;; srfi-13.scm --- SRFI-13 procedures for Guile ;;; srfi-13.scm --- SRFI-13 procedures for Guile
;;;; ;;;
;;;; Copyright (C) 2001 Free Software Foundation, Inc. ;;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
;;;; ;;;
;;;; This program is free software; you can redistribute it and/or ;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License as ;;; modify it under the terms of the GNU General Public License as
;;;; published by the Free Software Foundation; either version 2, or ;;; published by the Free Software Foundation; either version 2, or
;;;; (at your option) any later version. ;;; (at your option) any later version.
;;;; ;;;
;;;; This program is distributed in the hope that it will be useful, ;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details. ;;; General Public License for more details.
;;;; ;;;
;;;; You should have received a copy of the GNU General Public License ;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to ;;; along with this software; see the file COPYING. If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, ;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA ;;; Boston, MA 02111-1307 USA
;;;; ;;;
;;;; As a special exception, the Free Software Foundation gives permission ;;; As a special exception, the Free Software Foundation gives permission
;;;; for additional uses of the text contained in its release of GUILE. ;;; for additional uses of the text contained in its release of GUILE.
;;;; ;;;
;;;; The exception is that, if you link the GUILE library with other files ;;; The exception is that, if you link the GUILE library with other files
;;;; to produce an executable, this does not by itself cause the ;;; to produce an executable, this does not by itself cause the
;;;; resulting executable to be covered by the GNU General Public License. ;;; resulting executable to be covered by the GNU General Public License.
;;;; Your use of that executable is in no way restricted on account of ;;; Your use of that executable is in no way restricted on account of
;;;; linking the GUILE library code into it. ;;; linking the GUILE library code into it.
;;;; ;;;
;;;; This exception does not however invalidate any other reasons why ;;; This exception does not however invalidate any other reasons why
;;;; the executable file might be covered by the GNU General Public License. ;;; the executable file might be covered by the GNU General Public License.
;;;; ;;;
;;;; This exception applies only to the code released by the ;;; This exception applies only to the code released by the
;;;; Free Software Foundation under the name GUILE. If you copy ;;; Free Software Foundation under the name GUILE. If you copy
;;;; code from other Free Software Foundation releases into a copy of ;;; code from other Free Software Foundation releases into a copy of
;;;; GUILE, as the General Public License permits, the exception does ;;; GUILE, as the General Public License permits, the exception does
;;;; not apply to the code that you add in this way. To avoid misleading ;;; not apply to the code that you add in this way. To avoid misleading
;;;; anyone as to the status of such modified files, you must delete ;;; anyone as to the status of such modified files, you must delete
;;;; this exception notice from them. ;;; this exception notice from them.
;;;; ;;;
;;;; If you write modifications of your own for GUILE, it is your choice ;;; If you write modifications of your own for GUILE, it is your choice
;;;; whether to permit this exception to apply to your modifications. ;;; whether to permit this exception to apply to your modifications.
;;;; If you do not wish that, delete this exception notice. ;;; If you do not wish that, delete this exception notice.
;;; Commentary:
;; This module is fully documented in the Guile Reference Manual.
;;; Code:
(define-module (srfi srfi-13)) (define-module (srfi srfi-13))

View file

@ -1,6 +1,6 @@
;;; srfi-19.scm --- SRFI-19 procedures for Guile ;;; srfi-19.scm --- SRFI-19 procedures for Guile
;;; ;;;
;;; Copyright (C) 2001 Free Software Foundation, Inc. ;;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
;;; ;;;
;;; This program is free software; you can redistribute it and/or ;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as ;;; modify it under the terms of the GNU General Public License as
@ -40,9 +40,15 @@
;;; If you write modifications of your own for GUILE, it is your choice ;;; If you write modifications of your own for GUILE, it is your choice
;;; whether to permit this exception to apply to your modifications. ;;; whether to permit this exception to apply to your modifications.
;;; If you do not wish that, delete this exception notice. ;;; If you do not wish that, delete this exception notice.
;;;
;;; Originally from SRFI reference implementation by Will Fitzgerald. ;;; Commentary:
;;; Ported to Guile by Rob Browning <rlb@cs.utexas.edu>
;; Originally from SRFI reference implementation by Will Fitzgerald.
;; Ported to Guile by Rob Browning <rlb@cs.utexas.edu>.
;;
;; This module is fully documented in the Guile Reference Manual.
;;; Code:
;; FIXME: I haven't checked a decent amount of this code for potential ;; FIXME: I haven't checked a decent amount of this code for potential
;; performance improvements, but I suspect that there may be some ;; performance improvements, but I suspect that there may be some