Reputation: 19456
I've got a file at the path:
:/equities/AAPL.csv
I want a function
f(`AAPL)
that returns me the full file handler, including the .csv
.
I've tried using:
.Q.dd[`:/equities]`AAPL
which returns :/equities/AAPL
but I can't seem to get the .csv
part.
I'm also very happy to use the primitives rather than the Q
package (as this is just for learning).
Thanks!
Upvotes: 0
Views: 539
Reputation: 13572
This is one simple approach based on sv:
q){` sv y,x}/[`csv`AAPL`:/equities]
`:/equities/AAPL.csv
A more general approach for multiple inputs would be:
q)f:{` sv'x,'` sv'z,\:y}[`:/equities;`csv;](),
q)f`AAPL`IBM
`:/equities/AAPL.csv`:/equities/IBM.csv
Upvotes: 2