On Dec 13, 1:24 am, Rich Hickey <richhic...@gmail.com> wrote: > fnil seems to me to have greater utility than patching all functions > that apply functions with default-supplying arguments.
Hi Rich, To further comment on fnil, after having experimented with it a bit now, I've come to slightly prefer specifying the 'default' value before the function just because I think it reads nicer: (fnil 0 inc) ;; instead of (fnil inc 0) (fnil [] conj) ;; instead of (fnil conj []) I read it as "fill nil with 0 for inc" I suppose "fill nil of inc with 0" makes just as much sense but I find "inc 0" leads my eye to believe 0 will always be passed to inc, whereas "0 inc" does not. Putting the function last makes it clearer to me that the 0 is conditional. It also looks more like if nil 0. This contrasts with get, which makes perfect sense having the default last, but I think at this point fnil and get are sufficiently far apart that a different argument order would not be surprising. Just a small observation I thought I'd raise for discussion to see what preferences are out there if this function becomes widespread. Regards, Tim. -- 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