3 ms·
Some style stuff, for terseness, you can do things like change - move(left, State) -> move(getVector(left), State); move(right, State) -> move(get
by lostcolony 12y ago
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) ->
...
- skazka16 12y agoohh, I see. So I can pass Direction as an atom now..that's cool. Thanks!