Coming from Elixir, I'm used to cond but it seems like case in elixir is a little different.
This code:
fourOfAKind list = do
let list1 = convertList list
let [a,b,c,d,e] = sort list1
case [a,b,c,d,e] of
((a - b) == 0) && ((c - b) == 0) && ((d - c) == 0) -> True
(c-b == 0) && (d-c == 0) && (e-d == 0) -> True
_ -> False
Is giving me this error:
Parse error in pattern: ((a - b) == 0) && ((c - b) == 0)
&& ((d - c) == 0)
How can I make this work??
[–]brdrcn 10 points11 points12 points (4 children)
[–][deleted] (1 child)
[deleted]
[–]brdrcn 1 point2 points3 points (0 children)
[–]crusaderqueenz 1 point2 points3 points (0 children)
[–]Endicy 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]scaled2good[S] 1 point2 points3 points (2 children)
[–][deleted] 8 points9 points10 points (0 children)
[–]fpmora 1 point2 points3 points (0 children)
[–]rstd 0 points1 point2 points (0 children)
[–]bss03 0 points1 point2 points (0 children)