Maybe this is not even possible:
I want to create a function f that can have two input brackets like:
f[a_][b_:1]:= a*b
and alternatively just one input bracket:
f[a_]:= a
But with overloading the definitions the second definition interferes with the first definition, because the pattern f[a_] is replaced in a expression like:
In:
f[2][3]
Out:
2[3]
with the result of f[2] (in this case)
Of course, I could use just one bracket slot like f[a_,b_:1], instead of f[a_][b_:1], but thats not the point.
So i am asking for an optional bracket slot. Is that possible?
(BTW, I dont know the correct name of the []-Pattern, and called it bracket slot)
f[a_]andf[a_, b_], or two different functions? – 2012rcampion Feb 27 '15 at 00:26