> > > This gets to my question perfectly. Why is your code "my-list > (rest (rest my-list)) " legal? > I wouldn't have even thought to try that because, in essence, you are > changing my-list. I mean, I know how persistence works. You are just > reassigning what you think of as the start of my-list, and if no one > else is looking at the old version then it can get gc'd. I guess I > just assumed it would be harder some how. >
The expression (rest (rest my-list)) does not change anything. Its return value is a list that has fewer elements, and the original (unchanged) list still exists. This is common in the functional style of programming - most operations do not modify their arguments. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---