KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ How to remove or add items from a list Re: How to remove or add items from a list

  • mauricelim

    Member
    April 20, 2022 at 12:00 am

    You can use the drop (_) operator, where n is a number to drop.

    n_list

    To remove from the end of the list:

    -n_list neg[n]_list

    If you want to remove nulls, you can do something like:

    list except 0N

    You can use the drop with each (‘) operator to remove the same numbers of items from each list of different length, i.e.

    n_'(ls;ls2) -n_'(ls;ls2) neg[n]_'(ls;ls2)

    Or removing nulls from them

    (ls;ls2)except'0N