apply scalar function to all rows in table

Not sure why this doesn’t work. Please help.

/table t with columns a and b
/a scalar function f expects two scalars

f:{[a;b] …}

select f’[a;b] from t

Hi,

Could you give a bit more info here please?

The function f, what the table t looks like and the error you are getting.

Not really enough to go on currently, examples I’ve created have worked fine.

Thanks 

Andrew


From: personal-kdbplus@googlegroups.com <personal-kdbplus@googlegroups.com> on behalf of Sam <jain.samit@gmail.com>
Sent: 20 April 2017 14:30:36
To: Kdb+ Personal Developers
Subject: [personal kdb+] apply scalar function to all rows in table
 

Not sure why this doesn’t work. Please help.

/table t with columns a and b
/a scalar function f expects two scalars

f:{[a;b] …}

select f’[a;b] from t


Submitted via Google Groups

They syntax you are using should work. If it is not working, there must be something else – what’s the structure of your t? what does f do? what does it produce? what’s the exact error you are seeing?

as andrew said, your table or function may be unusual:


q)t:(a:1 2;b:3 4)


f checks that a and b are integers (scalar/atoms):

q)f:{[a;b]$[not (t=type a)&(type b)=t:type 1;'type;a+b]}

q)select f’[a;b] from t

b

-

4

6