mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
Update copyright.
Add commentary; nfc.
This commit is contained in:
parent
ead4514696
commit
0706ae06dc
3 changed files with 84 additions and 54 deletions
|
@ -1,6 +1,6 @@
|
|||
;;;; 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
|
||||
;;; 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.
|
||||
;;; 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)
|
||||
:use-module (ice-9 syncase)
|
||||
:export-syntax (let-values let*-values))
|
||||
|
@ -100,7 +118,7 @@
|
|||
; body ...)
|
||||
; (lambda lambda-tmps
|
||||
; (let-values-helper "cwv" lv-bindings final-let-bindings body ...)))
|
||||
|
||||
|
||||
; ((_ "consumer" (var-1 var-2 ...) (lambda-tmp ...) final-let-bindings lv-bindings
|
||||
; body ...)
|
||||
; (let-values-helper "consumer"
|
||||
|
@ -165,7 +183,7 @@
|
|||
; tmp-vars
|
||||
; ((vars-2 binding-2) ...)
|
||||
; body ...))))))
|
||||
;
|
||||
;
|
||||
; (syntax-rules ()
|
||||
; ((_ () body ...)
|
||||
; (begin body ...))
|
||||
|
@ -184,7 +202,7 @@
|
|||
((null? elts) '())
|
||||
((pair? elts) (cons (proc (car elts)) (map-1-dot proc (cdr elts))))
|
||||
(else (proc elts))))
|
||||
|
||||
|
||||
(define (undot-list lst)
|
||||
;; produce a non-dotted list from a possibly dotted list.
|
||||
(cond
|
||||
|
@ -199,7 +217,7 @@
|
|||
(let-vars (map (lambda (sym tmp) (list sym tmp))
|
||||
(undot-list (car var-binding))
|
||||
(undot-list new-tmps))))
|
||||
|
||||
|
||||
(if (null? (cdr vars))
|
||||
`(call-with-values (lambda () ,(cadr var-binding))
|
||||
(lambda ,new-tmps
|
||||
|
@ -209,7 +227,7 @@
|
|||
(lambda ,new-tmps
|
||||
,(let-values-helper (cdr vars) body
|
||||
(cons let-vars prev-let-vars)))))))
|
||||
|
||||
|
||||
(if (null? vars)
|
||||
`(begin ,@body)
|
||||
(let-values-helper vars body '())))
|
||||
|
@ -242,7 +260,7 @@
|
|||
body ...))))))
|
||||
|
||||
; Alternate define-macro implementation...
|
||||
;
|
||||
;
|
||||
; (define-macro (let*-values vars . body)
|
||||
; (define (let-values-helper vars body)
|
||||
; (let ((var-binding (car vars)))
|
||||
|
@ -253,7 +271,7 @@
|
|||
; `(call-with-values (lambda () ,(cadr var-binding))
|
||||
; (lambda ,(car var-binding)
|
||||
; ,(let-values-helper (cdr vars) body))))))
|
||||
|
||||
|
||||
; (if (null? vars)
|
||||
; `(begin ,@body)
|
||||
; (let-values-helper vars body)))
|
||||
|
|
|
@ -1,45 +1,51 @@
|
|||
;;;; srfi-13.scm --- SRFI-13 procedures for Guile
|
||||
;;;;
|
||||
;;;; Copyright (C) 2001 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 the Free Software Foundation; either version 2, or
|
||||
;;;; (at your option) any later version.
|
||||
;;;;
|
||||
;;;; This program is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;;; General Public License for more details.
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU General Public License
|
||||
;;;; along with this software; see the file COPYING. If not, write to
|
||||
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
;;;; Boston, MA 02111-1307 USA
|
||||
;;;;
|
||||
;;;; As a special exception, the Free Software Foundation gives permission
|
||||
;;;; 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
|
||||
;;;; to produce an executable, this does not by itself cause the
|
||||
;;;; resulting executable to be covered by the GNU General Public License.
|
||||
;;;; Your use of that executable is in no way restricted on account of
|
||||
;;;; linking the GUILE library code into it.
|
||||
;;;;
|
||||
;;;; This exception does not however invalidate any other reasons why
|
||||
;;;; the executable file might be covered by the GNU General Public License.
|
||||
;;;;
|
||||
;;;; This exception applies only to the code released by the
|
||||
;;;; Free Software Foundation under the name GUILE. If you copy
|
||||
;;;; code from other Free Software Foundation releases into a copy of
|
||||
;;;; GUILE, as the General Public License permits, the exception does
|
||||
;;;; 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
|
||||
;;;; this exception notice from them.
|
||||
;;;;
|
||||
;;;; If you write modifications of your own for GUILE, it is your choice
|
||||
;;;; whether to permit this exception to apply to your modifications.
|
||||
;;;; If you do not wish that, delete this exception notice.
|
||||
;;; srfi-13.scm --- SRFI-13 procedures for Guile
|
||||
;;;
|
||||
;;; Copyright (C) 2001, 2002 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 the Free Software Foundation; either version 2, or
|
||||
;;; (at your option) any later version.
|
||||
;;;
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this software; see the file COPYING. If not, write to
|
||||
;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
;;; Boston, MA 02111-1307 USA
|
||||
;;;
|
||||
;;; As a special exception, the Free Software Foundation gives permission
|
||||
;;; 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
|
||||
;;; to produce an executable, this does not by itself cause the
|
||||
;;; resulting executable to be covered by the GNU General Public License.
|
||||
;;; Your use of that executable is in no way restricted on account of
|
||||
;;; linking the GUILE library code into it.
|
||||
;;;
|
||||
;;; This exception does not however invalidate any other reasons why
|
||||
;;; the executable file might be covered by the GNU General Public License.
|
||||
;;;
|
||||
;;; This exception applies only to the code released by the
|
||||
;;; Free Software Foundation under the name GUILE. If you copy
|
||||
;;; code from other Free Software Foundation releases into a copy of
|
||||
;;; GUILE, as the General Public License permits, the exception does
|
||||
;;; 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
|
||||
;;; this exception notice from them.
|
||||
;;;
|
||||
;;; If you write modifications of your own for GUILE, it is your choice
|
||||
;;; whether to permit this exception to apply to your modifications.
|
||||
;;; 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))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; 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
|
||||
;;; 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
|
||||
;;; whether to permit this exception to apply to your modifications.
|
||||
;;; If you do not wish that, delete this exception notice.
|
||||
;;;
|
||||
;;; Originally from SRFI reference implementation by Will Fitzgerald.
|
||||
;;; Ported to Guile by Rob Browning <rlb@cs.utexas.edu>
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; 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
|
||||
;; performance improvements, but I suspect that there may be some
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue