toosuto-r / qchat

KDB+ end-to-end RSA encrypted chat fun
8 stars 3 forks source link

Last FM refactor #17

Closed ThomasSmyth closed 6 years ago

ThomasSmyth commented 6 years ago

Extensive updates to last fm code that serve to both simplify and expand functionality.

jonathonmcmurray commented 6 years ago

you use `$"@attr" all over the place - any chance you could just use .Q.id on the api results and then use `attr? Maybe with the level of nesting in the returned object that is infeasible

I think it's possibly just a dict, in which case something like:

q){.Q.id'[key x]!get x} (enlist`$"@attr")!enlist 123
attr| 123

Should work. Perhaps it would be useful to have a utility function like this, seeing as there are often things like this in API returned JSONs

q){$[99h=type x;.Q.id'[key x]!get x;.Q.id x]} (enlist`$"@attr")!enlist 123
attr| 123
q){$[99h=type x;.Q.id'[key x]!get x;.Q.id x]} enlist (enlist`$"@attr")!enlist 123
attr1
-----
123
ThomasSmyth commented 6 years ago

Added purge function as qid.

jonathonmcmurray commented 6 years ago

Nice qid function @vibronicshark55