Tag Info

New answers tagged

2

Sorry for being unprecise. I'm just wondering if your solution is the "official" way to deal with optional list arguments like in ImageTake. I also tried f[args:{x_, y_}:{1,2}] := {x, y}which seems to work. However, I'm not sure if understand it the right way... I do not believe I have seen a guideline or even a standard practice for this particular ...


6

There are many ways to achieve this, I'd probably do something simple like f[] = f[{}] (*set or set delayed, depends of context*) But you can also do something more fancy, although it is not compact enough for me to like it :P Default[f] = {}; f[Optional@{x_: 1, y_: 2}] := {x, y} f[] f[{}] {1, 2} {1, 2}



Top 50 recent answers are included