Skip to content
Browse files

Simplify code using lists:usort rather than sets, thanks to Ahmed Omar

  • Loading branch information...
1 parent a02fbcd commit 1852c68baf525524d21ea508dead3f51820141b5 @apauley committed
Showing with 1 addition and 3 deletions.
  1. +1 −3 sudoku.erl
View
4 sudoku.erl
@@ -40,9 +40,7 @@ peers(Square) ->
%% A unique list of squares (excluding this one)
%% that are also part of the units for this square.
NonUniquePeers = shallow_flatten([S || S <- units(Square)]),
- PeerSet = gb_sets:from_list(NonUniquePeers),
- PeersWithSelf = gb_sets:to_list(PeerSet),
- lists:delete(Square, PeersWithSelf).
+ lists:delete(Square, lists:usort(NonUniquePeers)).
values(Puzzle, Square) ->
%% Returns the digit values for a given square

0 comments on commit 1852c68

Please sign in to comment.
Something went wrong with that request. Please try again.