Actually this was said by Dijkstra long before Rich:
“Simplicity is a great virtue but it requires hard work to achieve it and
education to appreciate it. And to make matters worse: complexity sells
better.”
Unfortunately all 3 points are true. He also said:
“Simplicity is prerequisite for reliability.”
which is also true.
On Tuesday, 9 May 2017 14:11:46 UTC+2, Onorio Catenacci wrote:
>
> To paraphrase Rich Hickey--"Simplicity isn't easy". Figuring out those
> simple function signatures is not the first thing that comes to mind for
> most of us. But it's worth the effort.
>
>
> On Saturday, May 6, 2017 at 7:14:45 PM UTC-4, Josh Bourgeois wrote:
>>
>> I thought of practicing, but then I just wound up doing a lot of
>> thinking. Then it clicked 😬
>>
>> defmodule Words do
>> def count("" <> string), do: parse(string) |> Enum.reduce(%{}, &count/2)
>>
>> defp count("", map), do: map
>> defp count("" <> word, map) do
>> word |> String.replace("_", "-")
>> |> increment(map)
>> end
>>
>> defp increment(word, map), do: put_in(map[word], (map[word] || 0) + 1)
>> defp parse(string), do: string |> String.downcase |>
>> String.replace("-", "&hyph;") |> String.replace("_", "-") |>
>> String.replace("&hyph;", "_") |> String.split(~r/\W/u)
>> end
>>
>> It's just a challenge to think of meaningful names sometimes. Breaking
>> function/method bodies into smaller discrete blocks of work is obviously a
>> fundament to making code more readable, but it takes discipline and,
>> sometimes, a thesaurus
>>
>> Thank you for entertaining this zombie discussion once more 😶
>>>
>>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/59c6d90d-ded2-4794-8a73-920ab9350007%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.