Inspired about DS_London post - I create some samples and describe some 'Coding Policies' for myself, I'd like to share
I decide to create 2 functions =MatrixToList(M) and =ListToMatrix(L,C), where M is matrix to convert (several rows and columns), L is list (1-column matrix) and C number of columns to get. Both functions are easy to create so main is there show my 'Coding Policy')
1st - to create =LAMBDA is good to start in-cell function, most reasonable is to use =LET
2nd - all variables (and parameters) to write on different row (Alt-Enter)
3rd - on initial =LET separate 'parameters' and 'variables' so that there is internal =LET inside =LET
// remove comments and replace ; to , if neccessary
=LET(
m;A4#; // parameter
LET(r;ROWS(m); // internal LET inside LET
c;COLUMNS(m);
s;SEQUENCE(r*c;;0);
r_t;INT(s/c)+1;
c_t;MOD(s;c)+1;
t;INDEX(m;r_t;c_t);
t))
the second pre-function ListToMatrix
=LET( // remove comments and replace ; to ,
l;F4#; // parameter
c;$E$18; // parameter
LET(sr;SEQUENCE(ROWS(l)/c;;0); // internal LET
sc;SEQUENCE(;c;0);
t;INDEX(l;sr*c+sc+1);
IFERROR(t;"")
))
Why is that important or useful. Now can I with MINIMAL modification create LAMBDA from LET with simply removing parameter values (or moving to back)
=LAMBDA( // remove comments and replace ...
l; // parameter value removed
c; // parameter value removed
LET(sr;SEQUENCE(ROWS(l)/c;;0);
sc;SEQUENCE(;c;0);
t;INDEX(l;sr*c+sc+1);
IFERROR(t;"")
))
(F4#;$E$18) // neccessary in cell - unnessessary when into Name Manager
THanks for attention - just to share some ideas