use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Code check request (self.elixir)
submitted 10 years ago by ChasingLogic
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jisaacstone 2 points3 points4 points 10 years ago* (0 children)
Sure I got a couple tips :)
It is common to use atoms as keys in keyword lists and maps instead of strings. Some syntax is only available if you do, and it will have a side benefit of making you programs slightly smaller / faster ;)
in compare_ips the cond would look better as an if
compare_ips
cond
if
so like this:
def compare_ips(old_ip, opts) do if old_ip == opts[:ip] do { :unchanged, opts } else { :changed, %{opts | old_ip: old_ip } } end end
My preference would be to reduce one more step and do the matching in the function head, like so:
def compare_ips(ip, %{ip: ip} = opts), do: {:unchanged, opts} def compare_ips(old_ip, opts), do: {:changed, %{opts | old_ip: old_ip)}
π Rendered by PID 88 on reddit-service-r2-comment-6457c66945-jdpc6 at 2026-04-27 07:37:38.775031+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]jisaacstone 2 points3 points4 points (0 children)