*facepalm*
Yes, my way is the way not to do it; thanks to my reading comprehension
failure. ;)
-Dan
On 14-12-13 06:44 PM, John Cowan wrote:
Bahman Movaqar scripsit:
What is the idiomatic way of replacing the nth element in a list
*without* mutating the list? Is the combination of "take" and
"take-right" the right way to do it?
Yes, that's how I'd do it.
Daniel Leslie scripsit:
There are setters for car and cdr, so let's say you're at a position where
you want to replace the head of a list, you can then just do:
(set! (car some-list) some-value)
That's how you do it when you *do* want to mutate the list, or you can
use list-set! if you have it (as R7RS does).
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users