Reputation: 891
Is there a functional form equivalent to the following?
trades:([]date:`date$();time:`time$();sym:`symbol$();price:`real$();size:`int$(); cond:`char$())
Assuming the function name is "ct"...
trades:ct[fieldNames;types]
Upvotes: 4
Views: 337
Reputation: 1996
ct:{[fields;types] flip fields!types$\:()}
Example:
q)ct[`date`time`sym`price`size`cond;`date`time`symbol`float`long`symbol]
date time sym price size cond
-----------------------------
Will also work with char form of types:
q)ct[`date`time`sym`price`size`cond;"dtsfjs"]
date time sym price size cond
-----------------------------
Upvotes: 4