From 197f293583977e651134b3d3cfd60bfc0c0b1ea6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 21 Mar 2007 15:06:16 +0000 Subject: [PATCH] Implement REDUCE-LEFT, which has semantics of old REDUCE. --- v7/src/runtime/list.scm | 5 ++++- v7/src/runtime/runtime.pkg | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/v7/src/runtime/list.scm b/v7/src/runtime/list.scm index b9a27e666..12e9436f6 100644 --- a/v7/src/runtime/list.scm +++ b/v7/src/runtime/list.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: list.scm,v 14.54 2007/01/05 21:19:28 cph Exp $ +$Id: list.scm,v 14.55 2007/03/21 15:06:09 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -717,6 +717,9 @@ USA. (error:not-list list 'REDUCE)) initial))) +(define (reduce-left procedure initial list) + (reduce (lambda (a b) (procedure b a)) initial list)) + (define (reduce-right procedure initial list) (if (pair? list) (let loop ((first (car list)) (rest (cdr list))) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 2aace2f52..60f8068b2 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.612 2007/01/17 03:39:42 cph Exp $ +$Id: runtime.pkg,v 14.613 2007/03/21 15:06:16 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -2296,6 +2296,7 @@ USA. null? pair? reduce + reduce-left reduce-right restricted-keyword-list? reverse -- 2.25.1