I am used to using the following syntax when defining a function (in particular, for use in a package)
foo = method()
foo(RR, RR, RR, RR) := (a, b, c, d) -> (
a + b + c + d
)
The above example works fine and as expected, however the following,
bar = method()
bar(RR, RR, RR, RR, RR) := (a, b, c, d, e) -> (
a + b + c + d + e
)
throws an error (whether loaded from within package or not):
error: expected 1, 2, 3, or 4 parameter types
This error message appears in the file Macaulay2/d/actors.d.
My questions are:
- Is my syntax for defining a method correct, or is there a preferred way?
- Is this a hard-coded limit of 4 on the number of non-optional parameters that a method can take as input?
The workaround I have found is to define bar instead as:
bar = method()
bar := (a, b, c, d, e) -> (
a + b + c + d + e
)
which works for my setting (where it is a non-exported method for a package).