cancel
Showing results for 
Search instead for 
Did you mean: 

In funtional qSQL, what is the meaning when the operator is a list?

vivo
New Contributor II

In the below code, I can understand the meaning of (<), but cannot understand the meaning of (';~:;<). Why line 3 keeps 4 rows, while line 4 keeps 6 rows? What is the meaning of "~:" here?

 

t:([] c1:`a`b`c`d`e`f; c2:1 1 1 2 2 2; c3:10 20 30 40 50 60);
?[t;enlist((<);`c3;(44));0b;`symbol$()]; // I can understand this
?[t;enlist((';~:;<);`c3;({y-x};(min;15 25 35 45);44));0b;`symbol$()]; // why keep 4 rows?
?[t;enlist((';~:;<);`c3;({y-x};(min;35 45);44));0b;`symbol$()]; // why keep 6 rows?

 

1 ACCEPTED SOLUTION

gyorokpeter-kx
New Contributor II
New Contributor II

The queries are the functional equivalents of:

select from t where c3<44
select from t where c3>={y-x}[min 15 25 35 45;44]
select from t where c3>={y-x}[min 35 45;44]

In the 2nd example, min 15 25 35 45 evaluates to 15, {y-x}[15;44] is 29, and the condition c3>=29 is true for 4 rows.

In the 3rd example, min 35 45 is 35, {y-x}[35;44] is 9 and all rows satisfy c3>=9.

In the functional form, (';~;<) is just the representation of >=. If you type >= at the console, you can see it comes back as ~<, which is the composition of the operators ~ (not) and < (less than). The functional form includes the ' (composition) operator.

 

 

 

 

 

 

View solution in original post

1 REPLY 1

gyorokpeter-kx
New Contributor II
New Contributor II

The queries are the functional equivalents of:

select from t where c3<44
select from t where c3>={y-x}[min 15 25 35 45;44]
select from t where c3>={y-x}[min 35 45;44]

In the 2nd example, min 15 25 35 45 evaluates to 15, {y-x}[15;44] is 29, and the condition c3>=29 is true for 4 rows.

In the 3rd example, min 35 45 is 35, {y-x}[35;44] is 9 and all rows satisfy c3>=9.

In the functional form, (';~;<) is just the representation of >=. If you type >= at the console, you can see it comes back as ~<, which is the composition of the operators ~ (not) and < (less than). The functional form includes the ' (composition) operator.