cancel
Showing results for 
Search instead for 
Did you mean: 

All that jazz: The librarian’s song

SJT
Contributor III
Contributor III

Because q is a proprietary language, most of us know it as a language we learned in order to query large datasets. But q is a general-purpose programming language. The 32-bit interpreter is free for non-commercial use. It’s a great tool for general hacking. And lots of datasets need a little hacking.

This is the story of how I used q to hack metadata from 700+ WAV file names for import into Apple Music.

_mp3s-before.png

Cleaning up a dataset, finding and fixing problems, is always exploratory, and we get a taste of just how lively and responsive the q REPL is for this work. We use qSQL queries but the work also dips into their functional forms. (We also discover some ways to prevent Apple Music overriding our metadata.)

The script is also an example of functional vector programming in practice. 

There is plenty of iteration in the computation but few signs of it in the code. Many of the q primitives, and all qSQL queries, iterate implicitly. Where iteration needs specifying , iteration operators are used, but even these are used sparsely. (It is a common qbie error to use iteration operators when iteration is already implicit.)

There is no use of the do or while control words, and only a single if in the entire script.

Only three functions require multiple lines to define them; the longest has six.

There is also a preference for tacit forms rather than lambdas or setting variables that are read immediately and never used again.

Find the full article and code on GitHub.

1 ACCEPTED SOLUTION

davidcrossey
Moderator Moderator
Moderator

Jazz and vector programming are both difficult skills to grasp but very rewarding when one does become somewhat proficient. 🎷💻

Fascinating application of q to clean up your music library, and a fantastic article & post demonstrating the strengths of the language - thanks for sharing with the community Stephen! 👏🏻

David

View solution in original post

2 REPLIES 2

davidcrossey
Moderator Moderator
Moderator

Jazz and vector programming are both difficult skills to grasp but very rewarding when one does become somewhat proficient. 🎷💻

Fascinating application of q to clean up your music library, and a fantastic article & post demonstrating the strengths of the language - thanks for sharing with the community Stephen! 👏🏻

David

Echoing David's appreciation here - excellent post 🎷🙌