From 1e0cb9d68ae6275b53c2f7c977a8dbcb7ad3778e Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Sun, 26 Jan 2020 00:28:25 +0200 Subject: [PATCH] Remove scheme-lib/lazy.scm --- scheme-lib/lazy.scm | 47 --------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 scheme-lib/lazy.scm diff --git a/scheme-lib/lazy.scm b/scheme-lib/lazy.scm deleted file mode 100644 index 226a181..0000000 --- a/scheme-lib/lazy.scm +++ /dev/null @@ -1,47 +0,0 @@ -; SRFI 45: Primitives for Expressing Iterative Lazy Algorithms -; by André van Tonder -;========================================================================= -; Boxes - -(define (box x) (list x)) -(define unbox car) -(define set-box! set-car!) - -;========================================================================= -; Primitives for lazy evaluation: - -(define (eager x) - (box (cons 'eager x))) - -#| -(define-syntax lazy - (syntax-rules () - ((lazy exp) - (box (cons 'lazy (lambda () exp)))))) - -(define-syntax delay - (syntax-rules () - ((delay exp) (lazy (eager exp))))) -|# - -(define-macro (lazy exp) - `(box (cons 'lazy (lambda () ,exp)))) - -(define-macro (delay exp) - `(lazy (eager ,exp))) - -(define (force promise) - (let ((content (unbox promise))) - (case (car content) - ((eager) (cdr content)) - ((lazy) (let* ((promise* ((cdr content))) - (content (unbox promise))) ; * - (if (not (eqv? (car content) 'eager)) ; * - (begin (set-car! content (car (unbox promise*))) - (set-cdr! content (cdr (unbox promise*))) - (set-box! promise* content))) - (force promise)))))) - -; (*) These two lines re-fetch and check the original promise in case -; the first line of the let* caused it to be forced. For an example -; where this happens, see reentrancy test 3 below.