summaryrefslogtreecommitdiffstats
path: root/srfi-11.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:38 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:38 -0800
commit64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34 (patch)
tree1b23b8e8005328194e2fb4bf653806c85050933f /srfi-11.scm
parent5bea21e81ed516440e34e480f2c33ca41aa8c597 (diff)
downloadslib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.tar.gz
slib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.zip
Import Upstream version 3a5upstream/3a5
Diffstat (limited to 'srfi-11.scm')
-rw-r--r--srfi-11.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/srfi-11.scm b/srfi-11.scm
new file mode 100644
index 0000000..366e12e
--- /dev/null
+++ b/srfi-11.scm
@@ -0,0 +1,38 @@
+;;; This code is in the public domain.
+;;; http://srfi.schemers.org/srfi-11/srfi-11.html
+;;; by Lars T. Hansen 1999
+
+(define-syntax let-values
+ (syntax-rules ()
+ ((let-values (?binding ...) ?body0 ?body1 ...)
+ (let-values "bind" (?binding ...) () (begin ?body0 ?body1 ...)))
+
+ ((let-values "bind" () ?tmps ?body)
+ (let ?tmps ?body))
+
+ ((let-values "bind" ((?b0 ?e0) ?binding ...) ?tmps ?body)
+ (let-values "mktmp" ?b0 ?e0 () (?binding ...) ?tmps ?body))
+
+ ((let-values "mktmp" () ?e0 ?args ?bindings ?tmps ?body)
+ (call-with-values
+ (lambda () ?e0)
+ (lambda ?args
+ (let-values "bind" ?bindings ?tmps ?body))))
+
+ ((let-values "mktmp" (?a . ?b) ?e0 (?arg ...) ?bindings (?tmp ...) ?body)
+ (let-values "mktmp" ?b ?e0 (?arg ... x) ?bindings (?tmp ... (?a x)) ?body))
+
+ ((let-values "mktmp" ?a ?e0 (?arg ...) ?bindings (?tmp ...) ?body)
+ (call-with-values
+ (lambda () ?e0)
+ (lambda (?arg ... . x)
+ (let-values "bind" ?bindings (?tmp ... (?a x)) ?body))))))
+
+(define-syntax let*-values
+ (syntax-rules ()
+ ((let*-values () ?body0 ?body1 ...)
+ (begin ?body0 ?body1 ...))
+
+ ((let*-values (?binding0 ?binding1 ...) ?body0 ?body1 ...)
+ (let-values (?binding0)
+ (let*-values (?binding1 ...) ?body0 ?body1 ...)))))