# Why isn't my x parameter being read correctly?

**URL:** <https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [December 5, 2011, 12:32am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482 "2011-12-05T00:32:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![don1](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@don1](https://forum.kx.com/u/don1)\
**Post date:** [December 5, 2011, 12:32am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/1 "2011-12-05T00:32:00Z")

</div>

{y}[1;2] produces 2 as expected

{x}[1;2] produces error

'rank

I was expecting 1

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [December 5, 2011, 1:27am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/2 "2011-12-05T01:27:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rohit1](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@rohit1](https://forum.kx.com/u/rohit1)\
**Post date:** [December 5, 2011, 8:20am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/3 "2011-12-05T08:20:00Z")

</div>

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) [[mailto: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](mailto: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

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [December 5, 2011, 11:18pm UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/4 "2011-12-05T23:18:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [December 6, 2011, 5:37am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/5 "2011-12-06T05:37:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![don1](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@don1](https://forum.kx.com/u/don1)\
**Post date:** [December 7, 2011, 7:14am UTC](https://forum.kx.com/t/why-isnt-my-x-parameter-being-read-correctly/7482/6 "2011-12-07T07:14:00Z")

</div>

Thanks everyone for the insights
