From 03d478b854981003ea9d88a01e2c2ce7d7bf937e Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Mon, 13 Jun 2011 07:58:29 -0700 Subject: [PATCH] Define list-set\! --- src/runtime/list.scm | 6 ++++++ 1 file changed, 6 insertions(+) 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)) -- 2.25.1