On Wednesday, October 22, 2014 6:09:04 AM UTC-4, James Reeves wrote: > > On 22 October 2014 10:01, Phillip Lord <philli...@newcastle.ac.uk > <javascript:>> wrote: > >> James Reeves <ja...@booleanknot.com <javascript:>> writes: >> > >> >> Regardless, we have a nice example in Clojure, where we not >> >> distinguishing between data and computation allows us to do something >> >> nice. >> > >> > Yes... I agree it allows us to do something, but let's agree to >> disagree on >> > whether that something is "nice" :) >> >> Laziness? In my experience it is not nearly as useful as it is suggested >> to be, but it does seem to be pushed as a feature of clojure. > > > No, I mean unrestricted uniform access. > > Clojure's laziness is restricted to seqs >
Not quite; there's also delay and force, and it's possible to use these to construct other lazy data-structures. and is guaranteed to always produce the same value for the same field. > Nope: => (def foo (int-array [1 2 2 5 9 3])) #'user/foo => (def bar (seq foo)) #'user/bar => bar (1 2 2 5 9 3) => (aset foo 3 3) 3 => bar (1 2 2 3 9 3) That said, seqs still have their issues, even with their inherent > restrictions. For instance, it's easy to accidentally hold onto the head of > a seq, particularly if it's passed in as an argument to a function. For > example: > > (defn print-seq [xs] > (doseq [x xs] > (println x))) > Locals clearing should prevent head-holding in this case, since xs isn't referenced after the doseq, shouldn't it? -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.