Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- KX Community
- :
- Discussion Forums
- :
- kdb+ and q
- :
- Function Call Juxtaposition - Language Lawyer Ques...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Function Call Juxtaposition - Language Lawyer Question

User

Not applicable

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2015.07.07 06:50 PM

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 ?

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2015.07.12 09:16 AM

f (p1;p2;p3) is the juxtaposition and is picked up by the parser.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2015.07.14 01:09 AM

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:

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 callf 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 ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2015.07.14 09:06 AM

a[1][2][3]

This repeated item indexing expression is evaluated as:

((a[1]))[2])[3]

And expressions with multiple adverbs:

x @'' y

is evaluated as:

x (@')' y

But for the most part as José says the right to left order or evaluation is quite straightforward and one of the strong suits of q, k, j, and APL.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2015.07.17 03:36 AM

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

Charles

Main Office Contacts

**EMEA**

Tel: +44 (0)28 3025 2242

**AMERICAS**

Tel: +1 (212) 447 6700

**APAC**

Tel: +61 (0)2 9236 5700

Useful Information

Resources

KX. All Rights Reserved.

KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.