so currently I have my own definition of multiplication between elements but it can only multiply two elements.
MyMult[a_,b_]:=...
I want to multiply all elements in a list together with it i.e.
L = {a,b,c,d}
Ans = MyMult[MyMult[MyMult[a,b],c],d]
This however is messy and I want to create a function that takes in an arbitrarily sized list and outputs this product with MyMult.
Any thoughts on a neat/efficient way of doing it? Preferably one-liner sort of deal so I can define a function with it.
Fold
might help? $\endgroup$ – Anne Dec 7 '17 at 4:02Fold[myMult, L]
? $\endgroup$ – kglr Dec 7 '17 at 4:04SetAttributes[MyMult, Flat]
might help. $\endgroup$ – Αλέξανδρος Ζεγγ Dec 7 '17 at 4:51