Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
-module(transmatrix).
-export([trans/1,transL/1]).
% using built-ins hd = head, tl = tail
trans([[]|_]) -> [];
trans(M) ->
[ lists:map(fun hd/1, M) | transpose( lists:map(fun tl/1, M) ) ].
% Purist version
transL( [ [Elem | Rest] | List] ) ->
[ [Elem | [H || [H | _] <- List] ] |
transL( [Rest |
[ T || [_ | T] <- List ] ]
) ];
transL([ [] | List] ) -> transL(List);
transL([]) -> [].