News for hackers. Stuff that matters.
Re:2048 in Erlang by lostcolony on Monday June 09, 2014 @05:17PM (#7870579)
Some style stuff, for terseness, you can do things like change -

  move(left, State) ->
    move(getVector(left), State);
  move(right, State) -> 
    move(getVector(right), State);
  move(up, State) -> 
    move(getVector(up), State);
  move(down, State) -> 
    move(getVector(down), State);
  move(Vector, State) ->
    ...
to

  move(Direction, State) when is_atom(Direction) -> 
    move(getVector(Direction), State);
  move(Vector, State) ->
    ...
Re:2048 in Erlang by skazka16 on Tuesday June 10, 2014 @08:39PM (#7876079)
ohh, I see. So I can pass Direction as an atom now..that's cool. Thanks!