Viriya
Viriya

Reputation: 177

KDB How to cause infinite loop without recursion

Is there an expression that causes an infinite loop in KDB?

This is without using loops or recursion.

Upvotes: 1

Views: 573

Answers (2)

JPC
JPC

Reputation: 1919

I assume you mean without using while loops etc. You should look into the behavior of over and scan when the function that is applied is monadic. This behavior is detailed in the kx wiki iteration with over

Upvotes: 0

Matt Doherty
Matt Doherty

Reputation: 101

A statement including a scan or over adverb can get you stuck in an infinite loop. Something like:

{sqrt x}\[{x>0};100]

this will continually take the square root of the previous output (with an initial input of 100) until the answer no longer satisfies x>0. So the first argument is effectively a while, even though we don't use the while key word. Is this what you were looking for?

Upvotes: 2

Related Questions