September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 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([]) -> [].