From: Joe Marshall Date: Mon, 13 Jun 2011 14:58:29 +0000 (-0700) Subject: Define list-set\! X-Git-Tag: release-9.1.0~22^2~9 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=03d478b854981003ea9d88a01e2c2ce7d7bf937e;p=mit-scheme.git Define list-set\! --- diff --git a/src/runtime/list.scm b/src/runtime/list.scm index fa861904a..25751542a 100644 --- a/src/runtime/list.scm +++ b/src/runtime/list.scm @@ -326,6 +326,12 @@ USA. (error:bad-range-argument index 'LIST-REF)) (car tail))) +(define (list-set! list index new-value) + (let ((tail (list-tail list index))) + (if (not (pair? tail)) + (error:bad-range-argument index 'LIST-SET!)) + (set-car! tail new-value))) + (define (list-tail list index) (guarantee-index-fixnum index 'LIST-TAIL) (let loop ((list list) (index* index))