Hacker News new | ask | show | jobs
by Retra 4131 days ago
Familiarity makes it easier to learn, not easy. Just as long as you don't betray anyone's expectations about what they already know.

I remember struggling with Haskell because there is a function called 'nub', which wasn't anywhere near what I would have called the function if I had named it. Hoogle says "(The name nub means `essence'.)" In Lisp it is called 'remove-duplicates.' In Python it is list(set(x)). In SQL it is 'select distinct.'

So what advantage does nub pose? Not one of clarity, but of convenience for those "in the know." (Which is not those who are learning the language.)

1 comments

nub is widely recognized to be a terrible function; it's not indicative of anything
It's not? Then I suppose princ is a fine name for a print function.
Unfortunately, name, `nub`, is the best thing about this function. It has horrible (O(n^2)) performance, and only works with lists.