[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Protect against mutation
From: |
Bahman Movaqar |
Subject: |
[Chicken-users] Protect against mutation |
Date: |
Sat, 27 Dec 2014 16:16:05 +0330 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
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,
--
Bahman Movaqar
http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
signature.asc
Description: OpenPGP digital signature
- [Chicken-users] Protect against mutation,
Bahman Movaqar <=