I understand that its bad practice to use internal K functions that can be monadic or dyadic, but what about the simple aliases? For example, vs each. Which one is considered better style? Also how about over and scan vs / or ? Personally I use each but / and \ which seems inconsistent. Unfortunately Im the only Q developer at my company (no one got fired for choosing Q?) so I havent been able to see much actual Q code. Any opinions would be appreciated!
Many q keywords are simple wrappers. They are defined to make the language more approachable. It is tempting to regard them as trainer wheels to be discarded on graduation. But good q style is to use them: to write sum and raze rather than +/ or ,/.
Recommended stylistic practices sometimes conflict, and must be weighed against the intent to write clearly. For example, prefix and infix syntax is preferred to bracket notation: less visual noise. The each keyword iterates a unary, so count each x is better than count’. But combinations of iterators are usually best written concisely, so count’‘’ is clearer than
This, in my view, is why the many practices Ive seen proposed as rules for clear code are fragile guides at best. In æsthetics it is helpful to distinguish principles, and futile to legislate.
HTH
Stephen
Stephen Taylor | Librarian | Kx | +44 7713 400852 | stephen@kx.com
Many q keywords are simple wrappers. They are defined to make the language more approachable. It is tempting to regard them as trainer wheels to be discarded on graduation. But good q style is to use them: to write sum and raze rather than +/ or ,/.
Recommended stylistic practices sometimes conflict, and must be weighed against the intent to write clearly. For example, prefix and infix syntax is preferred to bracket notation: less visual noise. The each keyword iterates a unary, so count each x is better than count’. But combinations of iterators are usually best written concisely, so count’‘’ is clearer than
This, in my view, is why the many practices Ive seen proposed as rules for clear code are fragile guides at best. In æsthetics it is helpful to distinguish principles, and futile to legislate.
HTH
Stephen
Stephen Taylor | Librarian | Kx | +44 7713 400852 | ste…@kx.com