I’m running the free version of q on windows. I’m just wondering ifsomeone can explain this behavior:q)ndict:Symbol
Price!(MSFT;10.0)q)ndict[
Sym]q)mydict:
PriceSymbol!(10.0;
MSFT)q)mydict[`Sym]0nWhy don’t I get 0n in both cases as I would’ve expected?
The type of null you get back is determined by the type of the first element in the value.
charset=us-ascii
X-Mailer: iPhone Mail (8F190)
In-Reply-To: <83778cb0-193a-467a-9ad1-f822f1ce2961@1g2000yqq.googlegroups.com>
Message-Id: <19138066-3A4B-429D-9B18-B4A6C8948436@gmail.com>
Date: Tue, 12 Apr 2011 06:37:09 -0400
To: “personal-kdbplus@googlegroups.com”
Mime-Version: 1.0 (iPhone Mail 8F190)
The type of null is the first type in the dict.
Oh…What if I don’t have any knowledge of the values in the dictionary(and especially not the first value) and I need to write code that isdependent on if a key-value pair exists or not.e.g. boolval: adict[akey]~SOME\_NULL\_VALUE\_CONSTANTI just want to be able to determine whether the key (and its value)exists or not.On 12 Apr, 12:37, Nathan Perrem <nathan.per...> wrote:> The type of null you get back is determined by the type of the first element> in the value.>> On 12 April 2011 18:35, uman <mikaelu...> wrote:>>>> > I'm running the free version of q on windows. I'm just wondering if> > someone can explain this behavior:>> > q)ndict:
SymbolPrice!(
MSFT;10.0)> > q)ndict[Sym]> >
> > q)mydict:Price
Symbol!(10.0;MSFT)> > q)mydict[
Sym]> > 0n>> > Why don’t I get 0n in both cases as I would’ve expected?>> > –> >
Submitted via Google Groups</mikaelu…></nathan.per…>
To check for the existence of a key:
q)Symbol in key mydict 1b q) q)
Size in key mydict
0b