chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Protect against mutation


From: Christian Kellermann
Subject: Re: [Chicken-users] Protect against mutation
Date: Sat, 27 Dec 2014 15:00:15 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

* Bahman Movaqar <address@hidden> [141227 13:51]:
> Consider the following snippet:
> 
>  (use srfi-1)
>  (define (mutator lis n) (set! (first lis) n) lis)
>  (define ll (list 1 2 3 4))
>  (mutator (cdr lis) 100)
>  (equal? (second? lis) 100) --> #t
> 
> Is there anyway to protect "lis" from mutation? TIA,

No, you would need immutable list objects, which an egg provides
IIRC.

HTH,

Christian

-- 
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]