OK, fine. Any objections to "shuffle" and "rand-elt", to parallel "rand-int"?
On Feb 11, 2009, at 3:42 PM, Jeffrey Straszheim wrote: > "shuffle" seems perfectly fine. We *know* you aren't modifying it > in place, after all. > > Is there any reason we can't name random-element something like > random-elem ? I think that is a fine compromise. > > On Wed, Feb 11, 2009 at 6:37 PM, Jeff Valk <jv-li...@tx.rr.com> wrote: > > ----- Original Message ----- > From: Phil Hagelberg <p...@hagelb.org> > Sent: Wednesday 11 February 2009 13:16 > > > > > Jason Wolfe <jawo...@berkeley.edu> writes: > > > > >> Would you consider changing the names of these 2 functions ? > > >> > > >> random-permutation -> shuffle > > >> random-element -> one-of > > >> > > >> Shorter names are a trademark of clojure. > > >> "one-of" was taken straight from paip =) > > > > > > I'd be OK with shuffle, I guess, but I don't know if one-of is > > > descriptive enough for my taste. I feel like neither are used so > > > often that a slightly longer and descriptive name isn't merited. > > > > I'm not a fan of "one-of". If it has to be shorter, perhaps "pick- > rand"? > > > > -Phil > > I wrote essentially the same function as "random-element", but let > it take a collection. It looked like "nth" without the index arg, so > I called it "rand-nth". > > (defn rand-nth > [coll] > (nth (seq coll) (rand-int (count coll)))) > > One more naming option anyway. > > - Jeff > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---