How to Name Clojure Functions
stuartsierra.com
stuartsierra.com
Anyway, it is a problem that is not solved by a naming convention.
A lot of the performance and predictability problems in Haskell come from its laziness, so the ability to toggle that on and off on a per-module (read: per-file) basis will be a game changer.
I hear some of the mailings lists are informative - iirc there's a haskell-beginners one which will probably cover major updates in tooling, feature releases, and so on. Good luck!
[1]: https://www.fpcomplete.com/blog/2015/08/new-in-depth-guide-s...
There is no function
print :: String -> ()
(The type () implies "no interesting return value").This function could only be written via deliberate subversion of the type system. Instead it must be
print :: String -> IO ()
Which is similar, but the return is marked by this IO type. Essentially this restricts you to ensure that side effecting functions are executed in explicit sequence and cannot "poison" pure types.So instead of:
(-> x x->y y->z)
I'd have: (-> x y z)
Makes sense. Thanks for the post Stu!P.S. Another useful tome about naming functions is: https://github.com/bbatsov/clojure-style-guide
The trick is trying to telegraph to the consumer that your function logs. They need to know because it brings with it dependencies both by way of code and runtime requirements. Logging may fail for a variety of reasons. These would throw any consumer off. They have to plan for it.
When will functions be called in a transaction? STM ref, agent and atom updates.
Or, find better names for local variables, like customer-address. In the given example, there is in fact no need to add local variables: simply calling the functions would be enough.
Or require the function using a namespace alias.
Ah, but isn't Clojure Lisp-1? Then you can't have function `age` and variable `age` in the same scope despite `age` being a great variable name in many circumstances. Hence having to come up with silly variable names like "lst" instead of "list", because all the good names are taken by the functions.
That's a novel way to introduce an "industry standard".
More people need to present their opinions as the best way to do things.
Some useful, widely-cited examples: