doall example
I came across this today in a library: results (seq (doall (filter modified? files)))] I believe the seq is to coerce the empty list to nil. What is the doall for? Context here: https://github.com/ibdknox/watchtower/blob/master/src/watchtower/core.clj -- 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.
Re: doall example
The doall evaluates all items in the seq, effectively removing any lazy evaluation. In this case it's necessary because the filter is checking the modification date of the file, which is obviously mutable. - James On 17 May 2014 00:39, Brian Craft wrote: > I came across this today in a library: > > results (seq (doall (filter modified? files)))] > > I believe the seq is to coerce the empty list to nil. What is the doall > for? > > Context here: > > https://github.com/ibdknox/watchtower/blob/master/src/watchtower/core.clj > > -- > 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. > -- 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.
Re: doall example
Ah, thanks. Seems like there's still a race, though. In a long list of files, a sequence like 1) doall evaluates modification date of the first file, which is less than *last-pass*, so it is filtered out 2) something touches the first file 3) the doall finishes evaluating the rest of the list, after which *last-pass* is set to the current time Now the first file has been updated, but still has modification date less than *last-pass*, and will be filtered out of the next pass as well. On Friday, May 16, 2014 4:50:19 PM UTC-7, James Reeves wrote: > > The doall evaluates all items in the seq, effectively removing any lazy > evaluation. In this case it's necessary because the filter is checking the > modification date of the file, which is obviously mutable. > > - James > > > > On 17 May 2014 00:39, Brian Craft >wrote: > >> I came across this today in a library: >> >> results (seq (doall (filter modified? files)))] >> >> I believe the seq is to coerce the empty list to nil. What is the doall >> for? >> >> Context here: >> >> https://github.com/ibdknox/watchtower/blob/master/src/watchtower/core.clj >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.