From 10f62e3e7cbab2d3d0eb47380adeed8243e4ab0f Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:39:07 +0000 Subject: [PATCH] Convert multi-LETREC to internal definitions in sos/class.scm. --- src/sos/class.scm | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/sos/class.scm b/src/sos/class.scm index 101003095..409585bd7 100644 --- a/src/sos/class.scm +++ b/src/sos/class.scm @@ -259,23 +259,21 @@ USA. '()))) (define (remove-if! predicate items) - (letrec ((trim-initial-segment - (lambda (items) - (if (pair? items) - (if (predicate (car items)) - (trim-initial-segment (cdr items)) - (begin - (locate-initial-segment items (cdr items)) - items)) - items))) - (locate-initial-segment - (lambda (last this) - (if (pair? this) - (if (predicate (car this)) - (set-cdr! last (trim-initial-segment (cdr this))) - (locate-initial-segment this (cdr this))) - this)))) - (trim-initial-segment items))) + (define (trim-initial-segment items) + (if (pair? items) + (if (predicate (car items)) + (trim-initial-segment (cdr items)) + (begin + (locate-initial-segment items (cdr items)) + items)) + items)) + (define (locate-initial-segment last this) + (if (pair? this) + (if (predicate (car this)) + (set-cdr! last (trim-initial-segment (cdr this))) + (locate-initial-segment this (cdr this))) + this)) + (trim-initial-segment items)) (define (remove-item! item items) (if (pair? items) -- 2.25.1