Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Identity-matrix/Erlang/identity-matrix.erl
Normal file
11
Task/Identity-matrix/Erlang/identity-matrix.erl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
%% Identity Matrix in Erlang for the Rosetta Code Wiki.
|
||||
%% Implemented by Arjun Sunel
|
||||
|
||||
-module(identity_matrix).
|
||||
-export([square_matrix/2 , identity/1]).
|
||||
|
||||
square_matrix(Size, Elements) ->
|
||||
[[Elements(Column, Row) || Column <- lists:seq(1, Size)] || Row <- lists:seq(1, Size)].
|
||||
|
||||
identity(Size) ->
|
||||
square_matrix(Size, fun(Column, Row) -> case Column of Row -> 1; _ -> 0 end end).
|
||||
Loading…
Add table
Add a link
Reference in a new issue