0

From https://code.kx.com/q/wp/parse-trees/#the-solution

I came across below function, which translates enlisted symbols or symbol lists into the string "enlist".

ereptest:{ //returns a boolean
  (1=count x) and ((0=type x) and 11=type first x) or 11=type x}
ereplace:{"enlist",.Q.s1 first x}
funcEn:{$[ereptest x;ereplace x;0=type x;.z.s each x;x]}  <<<<<

In last line, it seems $ is applied to 5 arguments, but this page shows $ is of rank 2 or 3. What am I missing here?

kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80

1 Answers1

4

From the kx wiki

Odd number of expressions

For brevity, nested triads can be flattened.

$[q;a;r;b;c] <=> $[q;a;$[r;b;c]]

These two expressions are equivalent:

$[0;a;r;b;c]
    $[r;b;c]
Cathal O'Neill
  • 2,522
  • 1
  • 6
  • 17