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). -- John Cowan http://www.ccil.org/~cowan [email protected] You annoy me, Rattray! You disgust me! You irritate me unspeakably! Thank Heaven, I am a man of equable temper, or I should scarcely be able to contain myself before your mocking visage. --Stalky imitating Macrea _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
