Re: J vs Kdb+/Q

please see a new message from sa below---------- Forwarded message ----------From: Stevan Apter Date: Fri, Sep 19, 2008 at 10:56 PMSubject: Fw: [personal kdb+] Re: J vs Kdb+/QTo: effbiae@gmail.comhi jack. i’m having difficulty posting to the personal-kdb list, soif you wouldn’t mind posting this for me …kdb+/q has two components: k4, the underlying symbolic language, andq, a simple syntactic overlay on k4. q is exactly as powerful as k4.the overlay is simple: k4 has +x (transpose) and x+y (addition), qhas flip x and x+y. i.e. no ambivalence in q.k (i.e. k3) has atoms, lists, and dictionaries, q has atoms, lists,dictionaries, tables, and keytables. for the purist: q tables arelists of dictionaries having the same domain, and keytables aredictionaries where the domain and range are tables with the samecardinality.this simple extension, viz. having the interpreter recognize tableand keytable as derived types, has powerful implications. since +understands atoms and lists, it also understands tables (since a tableis a list) and dictionaries, and hence keytables. so the set ofpermissible operations in q is vastly larger than in k.since tables and keytables are types, the sql-like language of ksql(select, exec, update, delete, upsert, &c.) is a sublanguage of qrather than the reverse, as sql programmers might expect. in otherwords, the data language is a fragment of the programming language.in k we use a dictionary of equal-length lists to simulate a table.in q, we revert to the more intuitive idea that a table is a listof records, where a record is a dictionary of atoms. as a side-benefit, the indexing of a q table is what we would expect: table[rows;fields].in k, every global variable is a triple: a symbol (name), a value,and an attribute dictionary. since a dictionary is a whole whoseparts are variables, global variables are “right recursive” (i.e.variables in an attribute dictionary can have attributes.) thisis powerful, but often unwieldy. q takes a simpler approach: noattributes.q’s dependency and namespace model is simpler and more limitedthan k’s, but not intrinsically so. i expect that arthur willeventually flesh these out.q’s connection to the outside world is much richer and more highlydeveloped than k’s. this is important for people using q to developreal-world applications.and of couse k has a built-in mil-spec gui, whereas q does not.if you know k, you can’t do better than consult jeff borror’s"q for mortals."i came to q after 15 years programming in k (k1,k2,k3). wheneveri think i’ve got arthur figured he manages to surprise me. i’dcall it a relentless drive to simplify.----- Original Message ----- From: “Jack Andrews” To: Sent: Friday, September 19, 2008 8:43 AMSubject: [personal kdb+] Re: J vs Kdb+/Q>> i’m familiar with, but not an experienced user of kdb, k and j. q is> designed to look a little like sql (select …) but has quite a rich> set of primitives. q is a cut-down k – i don’t think the rank> operator comes up in q (but it does in k). there’s a page in wikipedia> for k (search for k programming language) that is a great overview. k> includes hash maps (or dictionaries) explicitly. i think k is great> and arthur is an amazing inventor.>> did you notice the announcement of JDB on the j mailing lists?>> ta, jack>> >

> since tables and keytables are types, the sql-like language of ksql> (select, exec, update, delete, upsert, &c.) is a sublanguage of qand i thought that q /was/ the sql-like language of kdb+. i didn’trealize that q was not ksql.> and of couse k has a built-in mil-spec gui, whereas q does not.i thought the gui was ripped out of k… what is a mil-spec gui?ta, jack

in typical vector programmer fashion, the single most importantinformation in stevan’s message was somewhat hidden and easy to miss:> k (i.e. k3)all his “k” remarks from there on applied to k3, the obsoletepredecessor language to k4 and q.specific to your questions:q is everything defined in q.k–english names for monadic functionsand various utility functions for db operations (and other things).“qsql” is sometimes used as the name for the four-arg “sql style"command construct for dealing directly with tables”(select|exec|update|delete) by from where". there’s no such thing asksql anymore (thank god!). the boundaries between “kdb+” and “q” arekind of fuzzy, at least imho. i suppose q is the language, and kdb+ isthe system, but there’s really not much point to distinguishing them.On Sat, Sep 20, 2008 at 9:15 PM, Jack Andrews wrote:>>> since tables and keytables are types, the sql-like language of ksql>> (select, exec, update, delete, upsert, &c.) is a sublanguage of q>> and i thought that q /was/ the sql-like language of kdb+. i didn’t> realize that q was not ksql.>>> and of couse k has a built-in mil-spec gui, whereas q does not.>> i thought the gui was ripped out of k… what is a mil-spec gui?>> ta, jack>> >>– Aaron Daviesaaron.davies@gmail.com

oh, and yes, the gui is completely gone from k4/kdb+/qhttp://en.wikipedia.org/wiki/Mil-specnot sure what sa meant by itOn Sat, Sep 20, 2008 at 9:22 PM, Aaron Davies <aaron.davies> wrote:> specific to your questions:> On Sat, Sep 20, 2008 at 9:15 PM, Jack Andrews wrote:>>> and of couse k has a built-in mil-spec gui, whereas q does not.>>>> i thought the gui was ripped out of k… what is a mil-spec gui?>>>> ta, jack>>>> >>>>>>>> –> Aaron Davies> aaron.davies@gmail.com>– Aaron Daviesaaron.davies@gmail.com</aaron.davies>

X-Mailer: Apple Mail (2.926)small, spartan, good enough for small things.On 20 Sep 2008, at 16:27, Aaron Davies wrote:>> oh, and yes, the gui is completely gone from k4/kdb+/q>> http://en.wikipedia.org/wiki/Mil-spec\>> not sure what sa meant by it>> On Sat, Sep 20, 2008 at 9:22 PM, Aaron Davies > <aaron.davies> wrote:>>> specific to your questions:>>> On Sat, Sep 20, 2008 at 9:15 PM, Jack Andrews >> wrote:>>>>> and of couse k has a built-in mil-spec gui, whereas q does not.>>>>>> i thought the gui was ripped out of k… what is a mil-spec gui?>>>>>> ta, jack>>>>>>>>>>>>>>>>>>> –>> Aaron Davies>> aaron.davies@gmail.com>>>>>> – > Aaron Davies> aaron.davies@gmail.com>> ></aaron.davies>

User-Agent: G2/1.0X-Google-Token: faCIOwwAAABqYL1OGLZsJQ-KvdQu2zy5X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)Message-ID: Subject: Re: J vs Kdb+/QFrom: jph To: “Kdb+ Personal Developers” X-Google-Approved: charles.g.skelton@googlemail.com via email at 2008-09-21 09:10:43> kdb+/q has two components: ?k4, the underlying symbolic language, and> q, a simple syntactic overlay on k4. ?q is exactly as powerful as k4.> the overlay is simple: ?k4 has +x (transpose) and x+y (addition), q> has flip x and x+y. ?i.e. no ambivalence in q.<…>Thanks for all this great information - it’s really helped meunderstand what Q is. Could you provide some similar description ofwhat KDB+ is? How about kdb+tick?

User-Agent: G2/1.0X-Google-Token: rBoocQwAAAAP4k9chP3iT7r5MxPBXB31X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe)X-HTTP-Via: 1.0 proxy4.mlp.com:3128 (squid/2.6.STABLE20)Message-ID: Subject: Re: J vs Kdb+/QFrom: sa To: “Kdb+ Personal Developers” X-Google-Approved: charles.g.skelton@googlemail.com via email at 2008-09-21 15:49:14there is a lot of confusion about what’s called what. i’m afraid i’vecontributedto the mystery.k1 k2 k3 k4 …as someone said, most of the examples on the net (e.g. my sitensl.com) is k3.k3 is obsolete. [there are a few k4 examples on nsl – e.g. the ray-tracer.]the current k is k4 (ambivalence)/q (no ambivalence). as someonesaid, q isdefined by the k4 script q.k. you can define your own syntacticoverlay byredefining q.k. i wonder if anyone’s done this?the confusion may be due to the fact that people sometimes use “k” torefer to the whole research program from k1 to k4 (and beyond), andsometimes to refer to the current product offering from kx. i think ipreferthe former usage, unless context makes it clear that some othermeaningis intended. (arthur used to say that every language he wrote wascalled"a".)kdb+ is (i guess) the official name of the base product offered bykx. at least,that’s how i use the term, which i rarely do. someone from kx canscold meif i’m still adding to the confusion.my interest (and i assume it’s shared by most people here) is in thelanguage.did someone say that k3 contains a rank operator (and that k4/qdoesn’t?)that’s certainly mistaken. A+ (the precursor to k) had one, but noneof the k’sever did. the technical reason is that APLs after APL\360 had nestedarrays, i.e. arrays of (enclosed) arrays, while k has lists.in k, there’s no difference between matrix:(1 2 3;4 5 6) listofvectors:(1 2 3;4 5 6)a function can applied to the sublists of m (f’m) or to the cells of m(f’'m), but notthe “columns” of m except by flipping the matrix. depth is a weakform of rank.of course, the rank operator may make a return appearance someday.On Sep 21, 4:49?am, jph <jhow…> wrote:> > kdb+/q has two components: ?k4, the underlying symbolic language, and> > q, a simple syntactic overlay on k4. ?q is exactly as powerful as k4.> > the overlay is simple: ?k4 has +x (transpose) and x+y (addition), q> > has flip x and x+y. ?i.e. no ambivalence in q.>> <…>>> Thanks for all this great information - it’s really helped me> understand what Q is. Could you provide some similar description of> what KDB+ is? How about kdb+tick?</jhow…>

> Thanks for all this great information - it’s really helped me> understand what Q is. Could you provide some similar description of> what KDB+ is? How about kdb+tick?as i said earlier, exactly what kdb+ is is somewhat debatable (at least imho)i guess you could say it’s the database system implemented by the qinterpreter and managed using the q language?kdb+tick is a set of scripts written in q (as of last week; previouslywritten in k4) which implement a basic real-time market datasystem–ticks go from a feed (reuters, bloomberg, etc.) to afeedhandler, then to a tickerplant which batches them up and publishesthem to any clients (real-time databases, statistics generators, etc.)which have subscribed. the real-time database then add its tables tothe historical database at the end of the day.-- Aaron Daviesaaron.davies@gmail.com

User-Agent: G2/1.0X-Google-Token: dZ6rpAwAAADmvEI_Op1D-EySLE_xTa9OX-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2),gzip(gfe),gzip(gfe)Message-ID: Subject: Re: J vs Kdb+/QFrom: Slobodan Blazeski <slobodan.blazeski>To: “Kdb+ Personal Developers” X-Google-Approved: charles.g.skelton@googlemail.com via email at 2008-09-22 09:39:26Leaving kdb aside, q is the reason I wen’t into the land of arrayprogramming language, q code IS beautiful.I like j, and it has a great community,many cool ideas and acollection of excellent books and articles, (j for c programmers is myfavourite) but I really don’t like a "programs that look like a three-year-old with a particular fondness for periods and colons was setbefore the keyboard."bobi</slobodan.blazeski>