Custom concatenation of inner list Erlang -
I have a large list of some forms with data, which are included in the other names with the same data with other forms
The list format is quite complex and looks like this:
[[EVAL_SEQ_1, {walk, ListDataToConcat1}}], [{EVAL_SEQ_2, { This is the output that I want to: <[[[EVAL_SEQ_1, {FORMNAME, ListDataToConcat1 + ListDataToConcat2} [...] [...] }]}}] ...]
Where:
EVAL_SEQ_1 = form sequence number, form = for The name ListDataToConcat = Index
eg.Here my sample data:
[[{ "eval_data_12", {& lt; & Lt; "Prvl_mobable_asset_0000_h200401" & gt; & Gt;, ['F_01_0100', [1]}, {'F_01_0090', ["3"], {'F_01_0080', []}, {'F_01_0070', [99 99}}, {'F_01_0060 ', [[Era, 0}, {year, []}, {month, []}]}, {' F_01_0050 ', []}, {' F_01_0040 ', []}, {' F_01_0030 ', [] }, {'F_01_00 20', & lt; & Lt; & Gt; & Gt;}, {'F_01_0010', & lt; "4 - 8" & gt; & Gt;}]}}], [{"eval_data_11", {& lt; & Lt; "Prvl_mobable_asset_0000_h200401" & gt; {'F_01_0100', []}, {'F_01_0090', ["2"]}, {'F_01_0080', []}, {'F_01_0070', [22222]}, {'F_01_0060' [{Era, 0}, {year, []}, {month, []}]}, {'F_01_0050', []}, {'F_01_0040', []}, {'F_01_0030', []} {'F_01_0020', & lt; & Lt; & Gt; & Gt;}, {'F_01_0010', & lt; & Lt; "4 - 1" & gt; & Gt;}]}}], ...]
<> <<> [{"eval_data_11", {& lt; & Lt; "Prvl_mobable_asset_0000_h200401" & gt; & Gt; [['F_01_0100', [[], [1]]}, {'F_01_0090', [["2"], ["3"]]}, {'F_01_0080', [[], [ ], {'F_01_0070', [22222], [99 99]]}, {'F_01_0060', [[Era, 0}, {year, [}}, {month, []}], [era {0}, {year, []}, {month, []}]]}, {'f_01_0050', [[], []]}, {'f_01_0040', [[], []]}, 'F_01_0030', [[], []]}, {'F_01_0020', [[& lt; & Lt; & Gt; & Gt;], [& lt; & Lt; & Gt; & Gt;]]}, {'F_01_0010', [[is & lt; & Lt; "4 - 1" & gt; & Gt;], [has & lt; & Lt; "4 - 8" & gt; & Gt; I offer you this solution:
[edit] < P> I have modified the code to answer your last comment, there are still fuzzy things: - If the property is different, makes a separate record list?
- If not, what should be done with the asset name?
-
-
-
One comment, I'm missing some context, but if I Add information to collect, I will store it in an et table. It is easy to be fast, transparent to update this, and it is easy to convert to the list if necessary.
-Module (t) -compile ([export_all]). % Rec = {atom, term}% reclist = [rec, ...]% property = {bin, reclist}% eval_data = [{list, property}]% eval_set = [eval_data, ...]% recs = { Atom, [word]}% recslist = [recs, ...] addrec ({key, val}, recslist) - & gt; Val_list = proplists: get_value (key, recallists, []), [{key, [val] | Val_list]} | Proplists: delete (key, recalculate)] merge_reck (resl, revslists) - & gt; List: fold (funny (RE, ACC) -> Adrec (REC, ACC) closing, re-listing, recycle). Merge_value ([{Eval, {Asset, Reclist}}}, []) - & gt; [{Eval, {property, [{key, [val]} || {Key, val} & lt; - Richest]}}]; Merge_Vival ({{Eval, {Asset, Reclist}}], [{Eval_low, {Asset_low, Recslist}}]) - & gt; [{Minutes (Eval, Eval_low), {Min (Asset, Asset_low), merge_rec (Reclist, Recslist)}}]. Merge_set (Eval_set) - & gt; Lists: fold (funny (Eval_data, Acc) - & gt; merge_evival (Eval_data, ACC) end, [], Eval_set) test () - & gt; Eval_set = [[{"eval_data_10", {& lt; & Lt; "Prvl_mobable_asset_0000_h200401" & gt; {'F_01_0100', [1]}, {'F_01_0090', ["3"], {'F_01_0080' []}, {'F_01_0070', [99 99}}, {'F_01_0060' , [{Era, 0}, {year, [}}, {month, []}]}, {'F_01_0050', []}, {'F_01_0040', []}, {'F_01_0030', []} , {'F_01_0020', & lt; & Lt; & Gt; & Gt;} {'F_01_0010' & lt; & Lt; "4 - 8" & gt; {{"F_01_0100 ', []}, {' F_01_0090 ', [" 2 "]}, {{" eVil_data1 1 ", {< & gt; & gt;} , {'F_01_0010', & lt; "4 - 1" & gt; & gt;}]}}]], Merge_set)
Comments
Post a Comment