projects
/
mit-scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a28a0c7
)
Define list-set\!
author
Joe Marshall
<eval.apply@gmail.com>
Mon, 13 Jun 2011 14:58:29 +0000
(07:58 -0700)
committer
Joe Marshall
<eval.apply@gmail.com>
Mon, 13 Jun 2011 14:58:29 +0000
(07:58 -0700)
src/runtime/list.scm
patch
|
blob
|
history
diff --git
a/src/runtime/list.scm
b/src/runtime/list.scm
index fa861904a3a86d39644d6aa24b85ea070ed35ac5..25751542a0519b1b367ccf1cf80218527ab8bb85 100644
(file)
--- 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))