Home › Forums › kdb+ › Fastest Fibonacci sequence generator › Re: Fastest Fibonacci sequence generator
-
(reverse sums::)
is another method of generating a function composition https://code.kx.com/q/ref/compose/q)'[reverse;sums]~(reverse sums::) 1b
The definition you see for
reverse
is the monad form of the K verb|
. The colon is an aid to the interpreter, as unless immediately used, the verb always denotes it’s dyad.e.g. you can see the difference here, where the first item returned is the reverse of the list, and the second item is a projection of the OR dyad.
q)(|:;|)@:1 2 3 3 2 1 |[1 2 3]
You can examine these in the
.q
namespace & there is further reading here https://code.kx.com/q/basics/exposed-infrastructure/#unary-formsq)5#.q | :: neg | -: not | ~: null | ^: string| $:
In terms of the colons & their meanings, you can find more info & examples on this (and much more) in this excellent link https://github.com/quintanar401/DCoQ?tab=readme-ov-file#mystery-of-