SRFI-45: add promise? predicate.
authorMark H Weaver <mhw@netris.org>
Wed, 27 Mar 2013 01:22:11 +0000 (21:22 -0400)
committerMark H Weaver <mhw@netris.org>
Wed, 27 Mar 2013 01:22:11 +0000 (21:22 -0400)
* module/srfi/srfi-45.scm (promise?): Export.

* doc/ref/srfi-modules.texi (SRFI-45): Update docs.

* test-suite/tests/srfi-45.test: Add test.  Add FSF copyright for 2010
  and 2013.  Add missing year to André van Tonder's copyright notice.

doc/ref/srfi-modules.texi
module/srfi/srfi-45.scm
test-suite/tests/srfi-45.test

index c99905c..513bb59 100644 (file)
@@ -3845,6 +3845,13 @@ words, no program that uses the R5RS definitions of delay and force will
 break if those definition are replaced by the SRFI-45 definitions of
 delay and force.
 
+Guile also adds @code{promise?} to the list of exports, which is not
+part of the official SRFI-45.
+
+@deffn {Scheme Procedure} promise? obj
+Return true if @var{obj} is an SRFI-45 promise, otherwise return false.
+@end deffn
+
 @deffn {Scheme Syntax} delay expression
 Takes an expression of arbitrary type @var{a} and returns a promise of
 type @code{(Promise @var{a})} which at some point in the future may be
index 7b7fedd..5194770 100644 (file)
@@ -1,6 +1,6 @@
 ;;; srfi-45.scm -- Primitives for Expressing Iterative Lazy Algorithms
 
-;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc.
 ;; Copyright (C) 2003 André van Tonder. All Rights Reserved.
 
 ;; Permission is hereby granted, free of charge, to any person
@@ -25,8 +25,8 @@
 
 ;;; Commentary:
 
-;; This is the code of the reference implementation of SRFI-45, slightly
-;; modified to use SRFI-9.
+;; This is the code of the reference implementation of SRFI-45, modified
+;; to use SRFI-9 and to add 'promise?' to the list of exports.
 
 ;; This module is documented in the Guile Reference Manual.
 
@@ -36,8 +36,9 @@
   #:export (delay
              lazy
              force
-             eager)
-  #:replace (delay force)
+             eager
+             promise?)
+  #:replace (delay force promise?)
   #:use-module (srfi srfi-9))
 
 (cond-expand-provide (current-module) '(srfi-45))
index 573eea0..e9fd029 100644 (file)
@@ -1,6 +1,7 @@
 ;;; -*- mode: scheme; coding: utf-8; -*-
 
-;; Copyright André van Tonder. All Rights Reserved.
+;; Copyright (C) 2010, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2003 André van Tonder. All Rights Reserved.
 ;;
 ;; Permission is hereby granted, free of charge, to any person
 ;; obtaining a copy of this software and associated documentation
 ;; Commented out since it takes too long
 #;
 (test-equal 300000000 (force (times3 100000000)))    ;==> bounded space
+
+
+;======================================================================
+; Test promise? predicate (non-standard Guile extension)
+
+(pass-if "promise? predicate"
+  (promise? (delay 1)))