Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
xs may be transformed from a parameter into an argument (ts)
L M A O
You can use foldr instead of foldl, so you don't have to reverse.
This comment is hidden because it contains spoiler information about the solution
You absolutely should.
This comment is hidden because it contains spoiler information about the solution
This looks nice and short but it iterates through the array twice, which is unnecessary.
I wouldn't really call this "best practice".
You really shouldn't initialize "smallest" and "largest" like that. What if all the numbers in the array are larger than 999999, but 999999 isn't in the array?
Then "smallest" would still be 999999. Likewise, largest would be -1 is all numbers are less than that but -1 isn't in the array, so it would return a false
minimum or maximum. Just set both smallest and largest to "lst[0]" and go from there.
Don't stop haha I like learning stuff. I've been learning Haskell only for a few months now, so I often overlook things like these and/or I just overthink it and it ends up looking way more complicated than it has to be. But I'll remember that one now. Thanks again!
Yes, one never actually sees it that way, when using it syntactically. Here is another one:
notElem False == and
. Gosh! I just can't stop refactoring Haskell code.Duh! For some reason it didn't even occur to me that ($) == (\x y -> x y).
Seems so obvious now haha thanks!
Interesting idea. Also:
You could also abstract your function combinators: