KX Community

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

Home Forums kdb+ How does (first”) works?

  • How does (first”) works?

    Posted by kdb_newbie on June 25, 2023 at 12:00 am

    dict:`a`b`c!((enlist 1; enlist `a);(enlist 2;enlist `b);(enlist 3;enlist `c))
    q)(first”) dict
    a| 1 `a
    b| 2 `b
    c| 3 `c
    q)(first’) dict
    a| 1
    b| 2
    c| 3
    q)

    How does (first”) work, please? And then how would (first”’) work?
    Thank you!

    kdb_newbie replied 8 months, 2 weeks ago 2 Members · 1 Reply
  • 1 Reply
  • rocuinneagain

    Member
    June 26, 2023 at 12:00 am

    https://code.kx.com/q/ref/maps/#each

    ' operates the same as each in these cases

     

     

    (first'') dict 
    a| 1 `a 
    b| 2 `b 
    c| 3 `c 
    
    {first each x} each dict 
    a| 1 `a 
    b| 2 `b 
    c| 3 `c 
    
    (first')dict 
    a| 1 
    b| 2 
    c| 3 
    
    first each dict 
    a| 1 
    b| 2 
    c| 3

     

Log in to reply.