Getting Started with APL
Dyalog APL is now easier than ever to install:
https://www.dyalog.com/download-zone.htm
I have been giving a number of talks and workshops on APL recently, and somewhat to my surprise, people are interested! However, this has led to a small dilemma, because the next question seems to be, "How do I get started?" You would think this would be my favorite question, but it is more scary than you might think. That's because I do not have a good answer right now. I want to simply say, "Here, read this book," but that book does not currently exist. (Consider supporting me on Patreon to help make a book like this a reality!) When I started to learn APL, I did read much online, but I never really followed a set path for discovery, and I was motivated enough that such an unstructured learning was not a problem. Still, that means I cannot just point people to where I started and expect that to be good enough.
This does not mean hope is lost, but until I write the book I want, there won't be a one stop solution to my dilemma. Part of this difficulty stems from the nature of APL itself, some from the community, and some from the unique needs of a would-be student of APL. So we really have to start by asking, what is your learning goal? Here are the main three I have seen:
- I have inherited some APL and want to maintain or update it;
- I just want to write my specific application and need help getting the frameworks and libraries on point;
- I think APL is neat and want to learn the language, and I really want to be good, but I have no specific application in mind yet.
I really want to focus on the third item in this article, but let us spend some time on the other two first.
If you already have an application or some code you need to work with, then you are in the best shape, because Dyalog's documentation is already very well written as reference material. You have a host of resources through the built-in help materials included in Dyalog APL. Moreover, you have some code to study that is in your specific domain already, and that is relevant to you. This code may not be the best, and it will likely pay for you to learn how modern APL is best written, but that code and the cornucopia of reference materials are the best and most direct places to start.
If you are starting from scratch on your own application, you may still need some help on learning the canonical way to write the logic, but you can probably search online for similar problem domains to see how others before you have solved similar problems. The resources I mention later will also help here, but you are likely to need some help on libraries, frameworks, and interfaces that are a part of linking in any application with the wider world.
The good news is that, here too, we are in a pretty good place. If you watch Dyalog.tv then you can learn of many of the new functionality coming out to interface with all manner of external systems. There is the reference material, too. Finally, the excellent book, Mastering Dyalog APL, is available in print or digital form. A free version is also available.
The Mastering Dyalog APL book is excellent and practically tailor-made for anyone wanting to write a specific application with little prior APL experience. The first part of the book covers the technical basics of the language proper, and then the rest of the book dives into much of the interfaces and frameworks that an application designer may want. Some of the newer features and 3rd-party elements are not given any treatment, but there is more than enough there already.
Then there is the APL cookbook that is under development. This book will give you many turnkey recipes for getting practical things done that may not always see treatment in other books in as accessible a manner. The combination of Mastering Dyalog APL and the Cookbook should be a great start for application writers who want to start putting the puzzle pieces in place right away.
The pair of these books together do suffer from a major gap in content, though. These books may enable you to write code in APL, but they do not teach one to think and leverage the language as a notational tool of thought. If you just start writing code using these texts, you may end up writing something that looks much like Python. And if you already have some stuff you want to write, that may be fine, and you can learn the other stuff as you go along. But the power of APL comes from using it as a tool of thought. These books will not really help you master the power of the language itself.
At the point where you start to want to really learn the language itself as a tool of thought, where we see the masters solving and explaining solutions to complex problems using incredibly concise, direct expressions, the third class of learning shows up and the second class eventually arrives. And it is here where I have the most interest.
APL comes into its own when you start to think in the language and you reduce your dependency on black-box library units that you fit together inflexibly and verbosely. But this is a style of thinking and coding that is very alien to the normal programmer. And there are precious few resources designed specifically to teach you how to think in APL.
I have spoken a couple of times about Escaping the Beginner's Plateau, and I feel that these talks help to set the stage for getting into APL, but they only cover the mental paradigm shift required, and after that, you must spend time reading and writing code, much like learning any language or learning mathematical thought.
There is no good book to help you do this, though I am working on that. Instead, the best I can do right now is recommend a set of resources to play with. These are not necessarily designed with teaching in mind, so you need to read many of these with that in mind, and others will give you an opportunity to practice.
I recommend that you try everything out, type things into your session compulsively, and experiment like mad. Take some old code you may have written and try to re-implement it in the APL Way. One of the best things you can do is to read the literature that uses APL to explore problems and solve them. The J Software Archive contains a very well curated selection of such papers, and I am pleased to recommend it as a great place to read some of the classics. It's important to read APL code that many of the best exponents have written, in order to get a perspective on style, use case, and the evolution of APL into the modern world. It will also help you to expand your own understanding of how to solve problems with APL.
Of course, many of these older papers are written with an older style of APL code in mind. Fortunately, Dyalog has a very large archive of very helpful programs already written, documented, and explained, all of which are written in a more modern style. Check out their dfns archive for a whole set of function you can play with. It can make for a very enlightening experience. I would add that dfns, while a great first step, should encourage you to further explore the power of trains/direct programming as well, so don't limit yourself!
Finally, have fun, enjoy. Make sure to tell Dyalog that I sent you. ;-)
- APLWiki Language Overview
- APLWiki Discovering APL
- APLWiki Learning Resources
- Dyalog Getting Started Page
- Dyalog Tutorial
- Game of Life in APL
- A Sudoku Solver in APL
- Depth-first Search in APL
- Mastering Dyalog APL
- FunctionalConf '17 Workshop
- J Software Paper Archive
- APL in 50 Expressions
- APL Exercises
- FinnAPL Idiom List
- Vector Journal
- APL Wiki
- Project Euler
- Notation as a Tool of Thought
- Dyalog Programming Competition
- Dyalog's dfns archive
- Dyalog Cookbook