mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
SRFI-45: add promise? predicate.
* 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.
This commit is contained in:
parent
65ad02b96d
commit
d291d7990d
3 changed files with 22 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
@ -258,3 +259,10 @@
|
|||
;; 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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue