Hi! I’m new to both elixir and this forum, so if i’m doing stuff wrong please tell me, and i’ll correct it
I’ve written a library to rate poker hands as my first real project in elixir, comming from a php and javascript background. It’s working, but considering I’m a newbie, i guess there’s some stinky and straight out bad code in there
If someone would care to take a glance at it, and maybe hint at some improvements that could be made, i would be very grateful!
I’ve just had a quick glance. Looks quite good overall. I noticed two things:
Instead of repeated calls to elem/2 just pattern match the actual values in the function head
I doubt you really need to use the Stream module especially as you use Stream.take(5) immediately. Unless you need streams for lack of enough memory or other reasons it’s usually best to stick to Enum.
Alright. I thought I could save some unnecessary looping by doing stream instead of enum. But it might be overkill and hurt readability in this case… I could then also import all the enum methods i use at the top of the file, to clean it up further.
Really appreciate your feedback
Edit. I’ve updated the repo to implement your suggestions, I do think it reads better now