Showing results for 
Search instead for 
Did you mean: 

In-place attribute removal

New Contributor II

Is there any way to do this?  `# looks to always be creating a copy of the original list for  `g/`u, whether it's applied on a list reference or value. I wrote a C function to set the list object's u member (x->u) to 0, and from within q called this function and followed it up with re-applying the attribute (`g#) and this combination seems to clear the attribute without making a copy and also removes the references to the previous attribute data, allowing it to be garbage collected by .Q.gc[]. Is there another way? Thanks in advance.


Community Manager Community Manager
Community Manager

Thanks for your question @alvi_kabir919 !

Looking forward to seeing if the community can suggest a way of achieving this. 



New Contributor III
New Contributor III

According to the docs at Set Attribute | Reference | kdb+ and q documentation - Kdb+ and q documentation ( :

Setting or unsetting an attribute other than sorted causes a copy of the object to be made.


Using a C function as a workaround might work but it might also break in a future version when kdb+ internals change.