{y}[1;2] produces 2 as expected
{x}[1;2] produces error
'rank
I was expecting 1
{y}[1;2] produces 2 as expected
{x}[1;2] produces error
'rank
I was expecting 1
i reckon the “find implicit args” expression looks something like:
q) f:{“c”$120+til 1+(“x”,“y”,“z”) ? x}
so it finds two args when invoked with “y” but only one arg with “x”:
q)f “y”
“xy”
q)f “x”
,“x”
can anyone point me to this in q.k? ?i’ve not yet tried to understand q.k?
Has it to do with lambdas being compiled?<o:p></o:p>
<o:p> </o:p>
From: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] On Behalf Of Don Nguyen
Sent: Monday, December 05, 2011 6:03 AM
To: personal-kdbplus@googlegroups.com
Subject: [personal kdb+] Why isn’t my x parameter being read correctly?<o:p></o:p>
<o:p> </o:p>
{y}[1;2] produces 2 as expected<o:p></o:p>
<o:p> </o:p>
{x}[1;2] produces error<o:p></o:p>
<o:p> </o:p>
'rank<o:p></o:p>
<o:p> </o:p>
I was expecting 1<o:p></o:p>
<o:p> </o:p>
–
Submitted via Google Groups
the problem is that?
{y} is dydadic - it takes two parameters: x and y
{x} is monadic - it takes one parameter: x
when you call a monadic with more than one parameter, you get a rank error.
just like?
q)sum[0;1]
'rank
q)sum[0]
0
q)sum[(0;1)]
1
On Dec 4, 2011, at 8:27 PM, Jack Andrews wrote:
> i reckon the “find implicit args” expression looks something like:
> q) f:{“c”$120+til 1+(“x”,“y”,“z”) ? x}
>
> so it finds two args when invoked with “y” but only one arg with “x”:
> q)f “y”
> “xy”
> q)f “x”
> ,“x”
>
> can anyone point me to this in q.k? i’ve not yet tried to understand
q.k
pretty sure it’s not in q.k
lots of syntax, especially stuff shared by k & q, is in the binary and
not available for us to read
it’s not the invocation, it’s the code of the function
{x} is monadic, {y} is dyadic, {z} is triadic
Thanks everyone for the insights