mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 05:06:36 +02:00
Add scheme code to set immutable field
This commit is contained in:
parent
3d0f21a876
commit
bbd24a8972
1 changed files with 7 additions and 1 deletions
|
@ -25,13 +25,19 @@
|
|||
}
|
||||
return_closcall1(data, k, result); ")
|
||||
|
||||
(define (Cyc-set-immutable! obj val)
|
||||
(_Cyc-set-immutable! obj val)
|
||||
(cond
|
||||
((pair? obj) (map (lambda (o) (_Cyc-set-immutable! o val)) obj))
|
||||
((vector? obj) (vector-map (lambda (o) (_Cyc-set-immutable! o val)) obj))))
|
||||
|
||||
(define lis '(1 2 3))
|
||||
|
||||
(write
|
||||
(list
|
||||
(immutable? lis)
|
||||
(immutable? (car lis))
|
||||
(_Cyc-set-immutable! lis #f)
|
||||
(Cyc-set-immutable! lis #f)
|
||||
(immutable? lis)
|
||||
(immutable? (car lis))
|
||||
(set-car! lis 'a)
|
||||
|
|
Loading…
Add table
Reference in a new issue