Some Interesting Ideas

I am writing this post before I start my third day because having spoken to many veterans of APL I have learnt some interesting ideas:

  • The first idea being keep it simple. Bernard taught us that generally one line should have no more than 5 significant operations in it. This makes the code easier to read and maintain.
  • The concept that good APL code is 3 things; maintainable, easy to understand and clear to write.
  • Another APL programmer pitched the idea to me that APL code can be described as being elegant.
  • There are many ways to solve a problem however some are more elegant than others.
  • It is also better to have very clear spaced out code that is possibly not the most efficient as opposed to a complex one line statement that is very complex however more efficient.
  • The objective is to find the correct balance.

With all this in mind it’s time to start day 3…

Day Two

Day two of training was a steeper learning curve for everyone. Learning to interact with, identify and modify different types of variables opens a whole new bag of tricks. Again I have summarized my learning for today in bullet point form below:

  • We learnt more advanced ways of indexing matrix’s and vectors
  • We learnt the importance of the shape and rank of a variable and the peculiar fact that a scalar has no shape and a rank of 0.
  • Rank proved to be ever more important as we got into more complex variables.
  • We learnt about concatenation and the need for variables to conform to certain requirements in order to be concatenated.
  • The concept of linear mathematics and a small amount of how it is applied in APL and programming languages in general.
  • What a nested array is and why it is sometimes used, also when to use one and when not to use one.
  • The formatting in APL and how this can be used to produce presentations of concatenated arrays.
  • The reshaping of different variable types and why additional steps are necessary for some.
  • A brief history of the APL language.
  • We were tasked with writing functions to find data items and matrix’s and also to display data in an organised and presentable fashion.

That’s all I can remember for now however I did get lost in town for two hours today as well as take a chunk out of my thumb with a rather hefty knife so to say I am slightly tired and forgetful and this moment is an accurate statement. I will continue tomorrow…

First Day Of Training

Today was the first day of training. My teacher was the author of the book Mastering Dyalog APL, Mr. Bernard Legrand. Below is a list of all of the concepts and ideas that I learnt today. I am not aiming to explain any of the actual programming however I will be releasing a detailed write up of the programming and code towards the end of the week when the course finishes. Today I learnt:

• Basic operations such as multiplication and division along with the specialist symbols they use in APL.
• The assignment of variables and how variables may interact with each other using operands.
• Performing simple operations on sets of data.
• How to create a list or matrix and the differences between different types of variables.
• The use of the reshape feature and its purpose in the language.
• How to declare and manipulate multi-dimensional arrays.
• The meaning of shape and rank.
• The standard indexing of an array and vectors.
• The creation of dynamic and traditional functions and passing parameters to them.

Each of these bullet point have intricate implementations and purposes and learning them and when to use them was very insightful however we have only just scratched the surface of their full potential.

More to follow tomorrow…

The Start Of An Adventure

Tomorrow I start a week long course to enhance my programming skills ahead of an apprenticeship.

This marks the start of my adventure into the world of APL programming and full time employment.

Though daunting I am looking forward to learning from professionals and enjoying a new area of computing.

More posts to follow…

APL Keyboard Switching

Recently I’ve been learning a language called APL (A programming language)* and one thing that annoys me is, because APL requires a specific keyboard layout, you have to change between the APL layout and the English layout when switching between pieces of software.

To ease this burden some of the software will automatically switch the keyboard layouts however in some scenarios you may require the APL symbols in software such as Microsoft Office Word.

Word will automatically change your keyboard layout to UK or US English** meaning you will then have to manually navigate to the languages section and again change your keyboard layout.

After doing this many many times while writing documentation notes for myself I decided to write a quick solution.

For this program I used C# and only a small piece of code is needed to change the input language assuming System.Globalization is included:

InputLanguage.CurrentInputLanguage = InputLanguage;

To find the required IME and implement it I used the following code:

foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
    if (lang.LayoutName == "Dyalog APL IME (en-GB)")
        InputLanguage.CurrentInputLanguage = lang;

This small piece of code cycles through all your installed languages and finds the one entitled “Dyalog APL IME (en-GB)”, then it sets your current language to the one it found.

For my program I used listboxes to allow the selection of different keyboard layouts and I also added docking buttons to allow the form to sit comfortably in any corner of the screen,

You can download my program as a small executable from the following link:

Thanks for reading if you have any questions comment them and I’ll try and respond as quickly as I can,

Callum (flouc001)

* No I’m not joking that’s actually the name of it

** Country / Default language specific