The expression p1 p2 p3 is called a strand (vector notation in APL2) and it does not work in q. The only place vector notation (in the APL sense) works in q is in denoting simple lists of integers/reals.
f (p1;p2;p3) is the juxtaposition and is picked up by the parser.
The nice thing with q is that there is no guessing about order of evaluation. It’s right to left and that’s that. So in a case like f[a1;a2…an] an would evaluate first, then a_n-1, and so forth until a1. A quick experiment shows this clearly
q){x+y}[0N!1;0N!2]
2
1
3
Also, not sure if you intended to call f[(p1;p2;p3)], or f[p1;p2;p3]. Note that those 2 are different, the first one takes 1 parameter, while the second takes 3. And as @Erik Friis mentioned your f p1 p2 p3 won’t work.
On Tuesday, July 7, 2015 at 9:22:51 PM UTC-7, analyst wrote:
Hi,
Here is another language lawyerly question:
Usual function call syntax is like : f[(p1;p2;p3)]
Then how does the interpreter know the recognize the following as a function call
f p1 p2 p3 ?
Then if you were to think about function in bigger complex expressions, the question becomes even more interesting ?
Is there an general way to figure these correct syntax / order of evaluation questions out ?
Most things are evaluated from right to left, but not everything as Eric mentioned :)
Another example is evaluation of where clause in select statement: right to left evaluation inside each where clause, but left to right per comma separated condition
In analyst example f p1 p2 p3, it doesn’t work just because 1 2 3 is being treated as a single parameter, it will work with dot operator applied: f . p1 p2 p3