# How do you start thinking in vectors?

**URL:** <https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577>\
**Category:** Community Support\
**Tags:** blogs\
**Created:** [June 16, 2022, 12:40pm UTC](https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577 "2022-06-16T12:40:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SJT1](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@SJT1](https://forum.kx.com/u/SJT1)\
**Post date:** [June 16, 2022, 12:40pm UTC](https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577/1 "2022-06-16T12:40:00Z")

</div>

In his reply to How long should a name be @darrenwsun raises a point so important it deserves a thread of its own, so Im promoting it here. Darren wrote:

> As a dev using this language and a practitioner of the technology, I’m proud of its unprecedented performance and expressiveness in manipulating data. But when someone from other tech background complain about the steep learning curve and difficulty in reading (most) q code, I usually remain silent: I felt the pain and sometimes I still feel it by “how much succinct one can do something in q with very short names and chaining so many expressions.”
> 
> Don’t get me wrong  the language is beautiful, especially when looked from a mathematical context. It’s just that q lives in an era/ecosystem where a complex system usually involves multiple languages/stacks and the others adopt a very different perspective towards what it means by readability/clean.

When I joined the ranks of APL instructors years ago it was well known that students learned APL faster if they had not been exposed to other programming languages. (Ken always warned against confusing _unfamiliar_ and _difficult_.)&nbsp;

Back in the day, we took that as evidence of the superiority of his notation. Other languages were rubbish! One day all software would be written in APL.&nbsp;

Nowadays we know better. (I have written an application GUI in APL and I intend it to remain a once-in-a-lifetime experience.)

We need to be polyglots. Nothing bad in that: humans have been polyglots since the Old Stone Age. (Only in recent centuries have linguistic communities grown large enough to host monoglots.)&nbsp;

Which leaves us with the barrier of the _unfamiliar_. Q widened access to kdb+ by letting users exploit their knowledge of SQL. KX Insights is going further by providing access through Python and Web UI. But for those who need to write in q there remains the transition from what (in a recent ArrayCast episode) Joel Kaplan called the _one-potato-two-potato_ approach to  what shall we call it  _vector thinking_?

Vector thinking focuses on list operations. But Darren is right: the journey from&nbsp;one-potato-two-potato may be exhilarating but it it is not trivial.

A recent article in the _RSA Journal_&nbsp; on lifelong education stresses the challenge of unlearning as part of learning new skills. So heres my question.

**What helped you learn vector thinking?**

Last year I led an online workshop on vector thinking. We explored vector solutions in q to a small but non-trivial problem. Participants found it helpful, and I promised to hold another one. Perhaps its time? (Respond here to encourage me.)

---

<div class="post-metadata">

**Author:** ![darrenwsun1](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@darrenwsun1](https://forum.kx.com/u/darrenwsun1)\
**Post date:** [June 16, 2022, 1:24pm UTC](https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577/2 "2022-06-16T13:24:00Z")

</div>

Hah thanks for the quote, but I feel like you might get me wrong…

&nbsp;

Vector thinking/programming is a beauty of the language, and that’s a big part of where q’s unprecedented performance comes. In this aspect, it’s superior than many other popular languages. It took me a while to think vector-ly, but it’s worth.

&nbsp;

A major part of the learning curve though, mentioned via the previous reply, is coding style. For example, personally I’m not convinced nph is named better than nanosecondsPerHour. Having said that, I’m well aware that there is no point arguing which code style is better. I intended to share a perspective that it’s not uncommom for a q dev to also work in other languages, and that sticking to so vastly different styles has its own mental cost (and it’s not small).

&nbsp;

---

<div class="post-metadata">

**Author:** ![SJT1](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@SJT1](https://forum.kx.com/u/SJT1)\
**Post date:** [June 16, 2022, 1:38pm UTC](https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577/3 "2022-06-16T13:38:00Z")

</div>

Yes, I had missed your point: reading a different coding style adds to the effort already required to learn vector thinking!&nbsp;

You found the journey worth the fare, anyway. Me too. And, having made it, I write better code in other languages.&nbsp;

I wonder, can you tell us about anything that helped you learn vector thinking?&nbsp;

---

<div class="post-metadata">

**Author:** ![darrenwsun1](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@darrenwsun1](https://forum.kx.com/u/darrenwsun1)\
**Post date:** [June 16, 2022, 8:48pm UTC](https://forum.kx.com/t/how-do-you-start-thinking-in-vectors/12577/4 "2022-06-16T20:48:00Z")

</div>

What worked for me are:

- read and enjoy the beauty of those q code using vector programming
- refactor q code that uses loops (they are anti-patterns in many cases)
- review if explicit “each” is really necessary
