I have a function Now that I have the following list of lists: For example, with the To clarify yourself, Thanks! When I change my code, it returns: {<{a1, b1, c1} {B1, b2, b3}, {c1, c2, c3}}} {a1 + b1 + c1, b1 + b2} When a logic takes a list, it only connects the members, in your case, it adds A1, b1, c1}, {b1, b2, b3}, {c1, c2, c3} > But they are not equal dimensions, so you can not get the correct answer. In this situation, the map should be used. or f [d _] . I intend to list this function as a complete list. Say,
d = {1,2,3, ...} , then
f [d] gives me results (a number or whatever). So far, everything is clear.
p = {l1, l2, l3, ...} Is there a more efficient
f [p] Method to compare the map to calculate where the expected result is
{f [l1], f [l2], f [l3], ...} ?
SIN [x] function, it's mapping in the list is slow only by putting the list inside the logic, it's my function
f [d] ] And the lists do not seem to work with the list of P. What should I do to do this work? Can this be faster than the map?
f [d _]: = total [d] then, f [{a1, a2, a3}] Gives 1 + A2 + A3, as expected, but kills the machine {{{a1, a2, a3}, {b1, b2, b3}, {c1, c2, c3, c4}}]
Map [total, {{a1, b1, c1}, {b1, b2, b3}, {c1, c2, c3, c4}}]
plus @@@ {{a1, b1, c1}, {b1, b2, b3} {c1, c2, c3, c4}}
No comments:
Post a Comment