From: Chris Hanson Date: Wed, 21 Mar 2007 15:06:16 +0000 (+0000) Subject: Implement REDUCE-LEFT, which has semantics of old REDUCE. X-Git-Tag: 20090517-FFI~707 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=197f293583977e651134b3d3cfd60bfc0c0b1ea6;p=mit-scheme.git Implement REDUCE-LEFT, which has semantics of old REDUCE. --- 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