Forum Replies Created

  • pgyorok

    Member
    May 6, 2024 at 9:19 am in reply to: Variables in Fibanocci

    The meaning of / depends on the arity of the function being modified. If it’s a unary function, that function gets called again and again passing in the result from one invocation as the argument to the next one.

    For a binary function, the meaning would be to apply the function between the accumulator and the next element in the input list – however in this case when you call the iterated function, you have to pass in an initial value and the list to iterate over. If you just pass in one argument, you create a projection.

  • pgyorok

    Member
    May 6, 2024 at 9:16 am in reply to: Scan vs Over

    This is the standard behavior. Over only returns the last element, while scan returns the result after each step in the computation.

    Accumulators – Reference – kdb+ and q documentation – Kdb+ and q documentation (kx.com)

  • pgyorok

    Member
    May 6, 2024 at 9:14 am in reply to: show nullLong:0Nj

    It’s the type indicator for “long”. You can omit it as that is the default type, but only for 0N with a capital N (0n would be float).

  • pgyorok

    Member
    May 3, 2024 at 1:45 pm in reply to: advanced 3.6

    Can you check if the definition was actually successful and didn’t throw an error?

  • pgyorok

    Member
    April 16, 2024 at 4:10 pm in reply to: parrallel each and each prior

    It depends on the arity of the function being modified. If it’s a unary function, it’s peach. If it’s a binary function, it’s each-prior.

    Overloaded glyphs | Reference | kdb+ and q documentation – Kdb+ and q documentation (kx.com)

  • pgyorok

    Member
    April 10, 2024 at 4:29 pm in reply to: kdb version 4.0 changes to port?

    The handle is an OS level file handle, not the port number. In fact it is possible to open multiple connections to the same process and naturally they get different handles.

    Does the handle show up in .z.W before you try to close it?

    Can you check the logs of the remote process to make sure it’s working fine?

  • pgyorok

    Member
    April 3, 2024 at 3:53 pm in reply to: like comparison

    like takes a string on the right. “IBM” is a string. “t” is not a string but a character – this is a quirk in the syntax. If you want to have a one-character string you have to use enlist, in this case enlist”t”.

  • pgyorok

    Member
    April 3, 2024 at 3:35 pm in reply to: Keeping data querable while processes are taking down

    It is a good idea to have multiple processes with a load balancer in front. That way if one or more processes dies the others can still serve incoming requests.

    If you have multiple processes and you need to restart them, you could do it one by one such that there is always at least one process available.

  • pgyorok

    Member
    April 3, 2024 at 9:24 am in reply to: What is the difference between the sym files

    It is an unfortunate coincidence that one of the columns in the table happens to be called “sym”. It could be called anything, but usually it is a symbol column that is used as some kind of key (e.g. instrument ID).

    In a splayed table, symbol columns must be enumerated (see Splayed tables | Knowledge Base | kdb+ and q documentation – Kdb+ and q documentation (kx.com)). This is the reason for the sym file at the top level.

    You could have multiple sym files in a DB, for example one per table, but all of them need to be in the DB root to work.

  • pgyorok

    Member
    March 28, 2024 at 10:39 am in reply to: how to parse functional select in q

    EDIT: sorry for the illegible code blocks, there seem to be serious issues with this forum software.

     

    Can you make it more clear what you are trying to achieve?

    “How to parse functional select” – this would be something like

    q)parse"?[quote;();0b;time,sym,bid,ask!time,sym,bid,ask]"
    ?
    ,quote ()
    0b
    (!;,time,sym,bid,ask;,time,sym,bid,ask)

    However this is no different from “how to parse any expression in q”, there is nothing special in the expression being parsed is a functional select.

    If the question was “how to convert a functional select into a regular select” then your code is exactly doing that:

    q)table:"quote"
    q)parse "select time, sym, bid, ask from ",table
    ?
    quote
    ()
    0b
    time,sym,bid,ask!time,sym,bid,ask

    “How to get data from the functional select” is a different question. You might want to check Functional qSQL | Basics | kdb+ and q documentation – Kdb+ and q documentation (kx.com) which has plenty of examples. In this particular example you would simply write down the result of the parse expression in function call form:

    ?[$table;();0b;time,sym,bid,ask!time,sym,bid,ask]

    Note that here we are casting the string to a symbol, but that’s only because that’s what conforms to your function’s signature. You might want to consider changing it such that it takes a symbol for the table name instead, in which case you wouldn’t need a cast:

    ?[table;();0b;time,sym,bid,ask!time,sym,bid,ask]
    • This reply was modified 1 month, 3 weeks ago by  pgyorok.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.
    • This reply was modified 1 month, 3 weeks ago by  megan_mcp.