I'm a native English speaker and I would have a very hard time trying to formalize when to use "by" rather than "with." The two words have numerous and varied usages and there's a lot of overlap. If I were to try to generalize, I'd say: "By" tells you what method is being used to perform an action. "With" tells you which tool is being used.
Example: I split the apple by cutting it. I split the apple with a knife. But that leaves out a lot nuance and many other ways the two words can be interpreted. Because of the ambiguity I don't think renaming the function would accomplish much in terms of clarification. On Monday, December 31, 2018 at 10:27:09 AM UTC-5, Allen Madsen wrote: > > I'm a native speaker. > > `starts_with?` reads as `adjective` followed by a `preposition`. > `split_with` reads as `verb` followed by a `preposition`. > > So, this wouldn't be confusing to me. > > As far as `_with` vs `_by`, I think `_by` has a slight leaning to element > wise operations, whereas `_with` has a slight leaning towards operations > that work on multiple elements, such as specifying the sorting function > which would compare two elements together. However, there are many cases > where they could be interchangeable. > > Allen Madsen > http://www.allenmadsen.com > > > On Mon, Dec 31, 2018 at 9:44 AM José Valim <jose....@plataformatec.com.br > <javascript:>> wrote: > >> > My main point here is tthat "_with" in the String and List modules is >> used to compare terms directly, and functions with the "_by" suffix accept >> a function and process info based on that. >> >> I don't think we can consider the suffixes in isolation. That would be an >> unnatural way to organize the API. How "_with" is used in start_with? is a >> different meaning than split_with which is marked by the preceding verbs. >> So unless the preceding word is also in the same category, like >> max/min/uniq which are aggregations, I believe we are comparing apples and >> oranges. >> >> *José Valim* >> www.plataformatec.com.br >> Skype: jv.ptec >> Founder and Director of R&D >> >> >> On Mon, Dec 31, 2018 at 1:52 PM eksperimental <eksper...@autistici.org >> <javascript:>> wrote: >> >>> On Mon, 31 Dec 2018 13:19:51 +0100 >>> José Valim <jose....@plataformatec.com.br <javascript:>> wrote: >>> > From your group of functions, I would argue that only chunk_by is >>> similar >>> > to similar split_with, as the other functions are about computing a >>> > property from the data. So they may use the same suffix but the suffix >>> may >>> > not necessarily mean the same thing. >>> >>> Thank you José for taking the time to answer. >>> My main point here is tthat "_with" in the String and List >>> modules is used to compare terms directly, and functions with the "_by" >>> suffix accept a function >>> and process info based on that. >>> >>> The connotation that "_with" has on me is that an argument contains this >>> term; >>> while "_by" implies to do something like split, sort, group based on >>> this condition/rule which >>> happens to always be a function, not a term to compare to. >>> >>> I would also love to hear the opinion of native speakers. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com <javascript:>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/20181231195201.1b3d1c08.eksperimental%40autistici.org >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-co...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BiA1nJooFZDUhN8xhjGWeedo2-jNEQu4z%2Bfa6YCMS-sg%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BiA1nJooFZDUhN8xhjGWeedo2-jNEQu4z%2Bfa6YCMS-sg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/0a6fffbd-3217-4880-b2ca-460adf1fa85e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.