3 ms·
It is not the same. A1 = x * y + x A2 = y * x + x A1(1, 2), A2(1, 2) returns results 3, 4 If You want to change parameter order, You can
by rabarbers 5y ago
It is not the same.
A1 = x * y + x
A2 = y * x + x
A1(1, 2), A2(1, 2)
returns results 3, 4
If You want to change parameter order, You can use Grace~ operator like this:
A1 = x~ * y + x
it moves parameter x one position towards the end of the parameters list.
Sorry, I do not know how to post code snippets in HN properly.
- throwaway4good 5y agoIndent with 3 spaces or more.
- chrismorgan 5y ago(Two, actually.)
- geocar 5y agoI think they meant: A1 = x * y + x A2 = y * x + y
- rabarbers 5y agoA1 in Javascript pseudocode would be: function A1(x, y) {return x*y + x; } But A2 would be: function A2(y, x) {return y*x + y; } If you do not like the default order of implicit parameters, you can always use Grace~ operator to move x or y. Prefix form moves the parameter one position towards the beginning of the parameters list, postfix form moves one position towards the end of the parameters list: A1 = y~ * x + y or A1 = y * ~x + y or [Edit] A1 = y * x + y~ In the last example take into consideration, that without Grace~ operator y is the first parameter, so, you need to move it one position towards the end of the parameters list - therefore use postfix form of Grace~ operator.