# how do I read this k function

**URL:** <https://forum.kx.com/t/how-do-i-read-this-k-function/10677>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [December 14, 2015, 1:31am UTC](https://forum.kx.com/t/how-do-i-read-this-k-function/10677 "2015-12-14T01:31:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![User7](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@User7](https://forum.kx.com/u/User7)\
**Post date:** [December 14, 2015, 1:31am UTC](https://forum.kx.com/t/how-do-i-read-this-k-function/10677/1 "2015-12-14T01:31:00Z")

</div>

how do I read this k function and where do I find documenation for k

q)parse “til”  
k){$[0\>@x;!x;'`type]}

---

<div class="post-metadata">

**Author:** ![rory\_ororke](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@rory\_ororke](https://forum.kx.com/u/rory_ororke)\
**Post date:** [December 14, 2015, 6:13am UTC](https://forum.kx.com/t/how-do-i-read-this-k-function/10677/2 "2015-12-14T06:13:00Z")

</div>

It reads

If type x is \< 0 (@x) run til x (!x) else signal `type.

Interestingly ! in k matches the .q.key which explains

q)(key 10)~til 10  
1b

As for resources not to sure where to go. you can start by looking at q.k to get a feel for it.

Thanks Rory

---

<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:** [January 11, 2016, 1:10am UTC](https://forum.kx.com/t/how-do-i-read-this-k-function/10677/3 "2016-01-11T01:10:00Z")

</div>

there isn’t much documentation for k4 availableif you have help.q loaded, help`verb is a good place to start  itgives you the monadic meanings of the punctuation functions (! is key,@ is type, etc.)you can also search .q for the functions that are direct aliases tomonadic punctuation:{(where 101h=type each x)#x}.qthe rest of k is mostly slightly different parsing rules (nounderscores allowed in sym literals, newlines act as semicolons, the.q namespace isn't special, enlist isn't really the same as monadiccomma, etc.) and none of that is really documented anywhere afaikOn Mon, Dec 14, 2015 at 1:13 AM, 'Rory O'Rorke' via Kdb+ PersonalDevelopers <personal-kdbplus> wrote:&gt; It reads&gt; If type x is &lt; 0 (@x) run til x (!x) else signal `type.\> Interestingly ! in k matches the .q.key which explains\>\> q)(key 10)~til 10\> 1b\>\> As for resources not to sure where to go. you can start by looking at q.k to\> get a feel for it.\>\> Thanks Rory\>\> On Mon, Dec 14, 2015 at 12:31 PM, analyst \<analyst.tech.jobs\>\> wrote:\>\>\>\> how do I read this k function and where do I find documenation for k\>\>\>\>\>\> q)parse “til”\>\> k){$[0\>@x;!x;'`type]}\>\>\>\> –\>\>

Submitted via Google Groups\</analyst.tech.jobs\>
