Raspberry APL Pi and Python on the micro:bit

A couple of years ago I spent many happy hours writing APL code to control robots which each embedded a Raspberry Pi. It was fun but it was a bumpy ride – my interest eventually faded when I discovered that it was just too difficult to make sense of raw accelerometer data, which I was hoping to use for precise navigation. After I managed to fry my MPU-9150, I decided to pursue other interests, as they say.

Recently, Romilly Cocking has been waxing lyrical about a number of new components which he thinks will make the whole experience more enjoyable – and I have decided to dive back in. So far, it has indeed been a very pleasant experience.

The Raspberry Pi Model 3

The Raspbery Pi Model 3While I was away, the Raspberry Pi and the software available for it have come a VERY long way. The speed of a Pi 3 makes it a perfectly usable computer. I am writing this blog entry on the Pi using a standard Chromium browser. APL starts up immediately, using our new graphical IDE. It is quite simply amazing!

The BBC micro:bit and MicroPython

The first generation of APL-based robots used an Arduino to manage the motors and sensors because timing was too critical for the Pi to handle it. I spent some rather unhappy hours writing a control program in C, debugging that without any tools. You could not even do “printf debugging” to the serial port because that interfered with the timing so much that it stopped everything from working.

Romilly suggested I take a look at the micro:bit, and since I have been using an interactive REPL all my life, he suggested that I run MicroPython on it.

He was right, I’m loving it!

Getting Started

I purchased the Kitronik Inventors’s Kit for the micro:bit from Pimoroni, and quickly found videos on Youtube explaining how to assemble it. I installed the “mu” editor on my Pi and was immediately able to edit a simple Python program and run it on the micro:bit.

My next step was, of course, to create a little class to drive MicroPython from APL. This involves using serial I/O: when the micro:bit is attached to your Pi via USB it appears as a folder and as a serial (tty) device, typically /dev/ttyACM0. You can find my code in the APLPi/microbit GitHub repository.

If you clone the repository to /home/pi/microbit and start APL, you can make calls to the MicroPython repository along the lines of:

    ]load /home/pi/microbit/microbit    
    mb←⎕NEW microbit ''
    mb.PyREPL '2+2'
4

Using Python on the micro:bit to do maths isn’t that interesting when you have APL on the Pi; the exciting thing is that we can call the micro:bit Python API and access the hardware. My first experiment was to display my favourite APL symbol (Grade Up – aka Imperial Cruiser) in the built-in 5×5 LED display:

Imperial Cruiser on  the micro:bit

APL displaying an Imperial Cruiser on the micro:bit

Which of the Inventor’s Kit experiments would you like to see me do next?

Dan Baronet

Dan Baronet

Dan Baronet

We do not know the details, but Dan’s luck ran out this week. On Tuesday, as he headed South from Nevada into California, en route to Mexico on the first leg of a four month motor cycle adventure to South America, something went wrong … Dan lost control of the bike and collided with a motor home, and many of us are now struggling to comprehend that Dan won’t be back.

Dan made friends everywhere that he went. On our annual Dyalog skiing “retreat” (we frequently did real work on prototypes of new tools, honest!), I was always impressed (while trying to hide my slight embarrassment) by the way Dan always kicked off conversations with hotel staff. Whether the waiters and waitresses were native Italians from the resort town – or migrants as hotel staff frequently are – Dan would typically know enough words in some shared language to get the conversation off to a good start (or he would extend his vocabulary on the spot). This always guaranteed us service with a smile, and excellent advice on which wine to order for dinner.

Dan gave as well as he got: on the slopes, Dan was always the first to stop by anyone who had fallen over and was struggling to get back up. Dan has friends all over the world and always took the time to visit them when he could, to keep the friendships alive. He was also happy to open his own home to travellers, both my kids had little Canadian adventures as guests of Dan and his family in Quebec, and Dyalog team members would also “couch-surf” chez Dan.

At work, Dan also loved extending his vocabulary. He remembered more details of different APL dialects than anyone else that I know, and was an expert in migrating code from one system to another. He also knew the weaknesses of each system, and was a feared visitor to vendor booths at APL conferences. Dan would mischievously sit down to play with a new APL system, try a couple of his favourite edge cases, and usually manage to crash new (and some old) APL interpreters within seconds.

But even when crashing interpreters, Dan was really trying to help the vendor produce a more stable platform. At work, as on the ski slopes, Dan was one of the few people who was always going out of his way to help. When he had spent time learning a new technique, or how to use a new tool, he would go the extra mile to create a utility library, document it, presented it at conferences and APL user meetings. He also did the really hard part – writing an article about it, making frequent contributions to Vector and other publications: http://archive.vector.org.uk/?qry=baronet&submit=search. He also enjoyed teaching APL, as an instructor at I.P.Sharp Associates and in the modern era as the author of numerous tutorials at https://www.youtube.com/user/APLtrainer.

More than 30 years ago, as an APL rookie at I.P.Sharp Associates, I was fortunate to meet, work with, and learn from Dan when he and I both found ourselves at IPSA Copenhagen. In addition to a general interest in tools, I shared Dan’s interest in the migration of code between APL systems, and flying airplanes. Dan actually flew small aircraft (and helicopters!) and I, like so many other friends and colleagues, admired him and got invited along for rides.

A decade and a half later in 2005, as the new CTO of Dyalog, I was keen to add an APL toolsmith to the company. Despite his location in Montreal, Dan was at the top of my list. Dan continued to live in Montreal but was a frequent guest in Bramley, coming over several times a year to spend some weeks to work with the growing “APL Tools Team” – and with the core development team on improving the quality of the interpreter by crashing it in as many ways as he could think of.

When his imagination ran out, he wrote code to generate even more ways to crash the interpreter. Dan has been cursed loudly many times, and will be remembered – if for no other reason than that it will be a long time before we are able to close the last “issues” that he logged in our problem tracking system. The quality of Dyalog APL has increased enormously in the last decade, and we have much to thank Dan for. Dan also “poured the concrete” for the foundations of the source code management tool (SALT) and the User Command framework that we are all starting to take for granted, and contributed to many other pieces of our growing collection of tools.

C-GSXN in Toronto

Dan often flew himself to APL User Meetings

Dan was an adventurer. He skied, snowboarded, snowshoe’d, biked, skated, hiked and flew – and with his great sense of humour and warm personality, he was able to entice many of us to come along with him to share. He photographed and brought his video camera, although he would often manage a 3-week trip to Europe which included a skiing trip, carrying only a small backpack.

Dan had just turned 60, and he had taken four months leave this winter to pursue an old dream to revisit South America with a friend – on motor cycles. They had wisely gone on a trial ride in the late summer, riding from Canada to Las Vegas and parking the bikes there in order to test the equipment and not have to ride two-wheelers in the Canadian winter. As a pilot, Dan understood risks very well – or rather, how not to take unnecessary ones.

“If only he had been a little more cautious”, some will say. Was that trip really necessary? These thoughts are unavoidable – but we have to remember that his decision to ride was natural to the adventurous and mischievous spirit that we all knew and loved.

Rencontres Dyalog APL 2016 – Paris, France

It is really good to see APL events come back to life! In April of 2014, we witnessed the re-birth of SWEDAPL, which had been dormant for some time – but now meets twice a year and is perhaps the most vibrant APL meeting on our circuit, with many young developers developing new products and features in APL. The last SWEDAPL meeting drew a substantial international crowd, including a number of Danes – and the next one, scheduled for April 1st, is making a guest appearance in Copenhagen, hosted by Simcorp A/S – a bit like the Tour de France 🙂

paris16This year we are really happy to be back in France, which has also had a relatively dormant APL community for the last decade or so – at least in terms of holding meetings. In this case we decided to arrange a meeting with the help of our French distributor – Quantys. Although the invitation was to a “Dyalog User Meeting“, about half of the attendees were users of other APL systems than Dyalog APL – with a little luck this meeting will turn out to contain the seeds for a rebirth of an independent French APL group. Fingers crossed!

Everyone please note: If you want to organise a local APL event, and you invite a speaker from Dyalog, we will do everything we can to send one or two delegates to your meeting. The current “circuit” includes Finland, Germany and Sweden twice a year, France and the East Coast USA. We have been known to show up at the Bay Area Users’ Group from time to time, in Toronto, at J and kx meetings – and recently also at FunctionalConf in Bangalore.

After welcoming remarks from Marc Righetti of Quantys, Gitte talked about Dyalog’s commitment to ensure that APL is well-integrated with modern computing platforms and infrastructure, which is always in the throes of another revolution. The current movement towards cloud computing and the need for platform independence is no exception. The good news is that Dyalog is growing to meet the challenge; we expect to add another couple of heads this year and grow the company by another ten percent.

Dan Baronet is a native of Montreal, Canada. As one of our French-speaking team members, he ended up doing most of the heavy lifting, with presentations on the upcoming v15.0 release, and a recap of the recent language enhancements in version 14.0 – in particular, the rank and key operators and function trains. Nicolas Delcros also spoke in French on the subject of his most recent work on integrating the publishing capabilities of Adrian Smith’s NewLeaf tool to SharpPlot, under the name SharpLeaf. I was only allowed to interrupt the flow of French twice, first with a road map presentation and, in the afternoon, a brief introduction to Futures and Isolates.

At the end of an action-packed day, Quantys treated us all to Champagne and snacks – many thanks to Marc for running the show and taking good care of us. A single day was much too short a time to do justice to the last decade of Dyalog achievements – so we will have to be back more regularly!

FinnAPL Forest Seminar 2016

The view from the Sauna. Some people actually went in!

The view from the Sauna. Some people actually went in!

Finns probably have better reasons to look forward to spring more than most of us: not only does it get much easier to keep that hole in the ice open, it is time for the annual FinnAPL Forest Seminar!

This year, just under 20 of us gathered for two days (Thursday March 10th and Friday March 11th) at Hirvihaara Manor, about an hour north of Helsinki, to update each other on what we have been getting up to recently.

Thursday

After a warm welcome from Jouko Kangasniemi, Chairman of FinnAPL, Veli-Matti Jantunen from Statistics Finland kicked the proceedings off with a talk titled “The long way of an APL2 bigot to Dyalog world”, where he discussed features of recent versions of Dyalog APL, awarding some of them them varying numbers of thumbs up, declaring some to be irrelevant. A few were found to be flawed… We are hoping to talk him into a repeat at Dyalog’16 as this was a valuable and thought-provoking review!

I was on next – with the Spring 2016 version of the Dyalog Road Map. As should be confirmed by the slides, there is not a big change in direction. We are planning to increase headcount by another 10% this year and continue investing in the core interpreter technology, APL compilers, and tools to help you build applications on a growing number of platforms.

Ants on the left. Ray Cannon on the right

Ants on the left. Ray Cannon on the right

After lunch, Ray Cannon showed us how to “Build a better ant brain”, producing wonderful, coloured, animations with ants crawling all over the big screen, using MiServer 3.0 and a bit of JavaScript – running under Dyalog APL on a Raspberry Pi!

My technical keynote in the morning had included a demo of a very early prototype of a Python interface, which will allow APL users to tap in to Python libraries. I was, therefore, very interested in the next presentation by Esa Pursiheimo from the VTT Technical Research Centre of Finland – which gave us all an introduction to the Python language. There is no question that the Python community has built libraries that could be very useful to APLers (although I cannot say the language itself impressed me much 🙂 ).

The last presentation of the day, titled “Data Driven Documents” (aka “D3”), was also about using libraries written in other programming language to extend APL applications. In this case the language was JavaScript. Jouko Kangasniemi from the Confederation of Finnish Industries (EK) showed how he is generating JavaScript to call the popular D3 Graphics Library and publish charts that are relevant to Economic planners in Finland. A collection of animated charts created using this technology can be found at http://ek.fi/materiaalipankki/tietografiikka/talous/viikon-graafit/.

Since we were in Finland, the afternoon ended with a visit to a traditional “smoke sauna”, before we all scrubbed up for the banquet.

Cheers! From left to right (more or less): Antero Ranne, Gitte Christensen, Esa Lippu, Miika Rämä, Simo Kilponen, Jouko Kangasniemi, Heikki Viitamäki, Esa Pursiheimo, Olli Paavola, Kaarlo Reipas, Göran Koreneff, Morten Kromberg, Kimmo Kekäläinen, Veli-Matti Jantunen, Timo Korpela, Ray Cannon (Missing: Anssi Seppälä)

Cheers! From left to right (more or less): Antero Ranne, Gitte Christensen, Esa Lippu, Miika Rämä, Simo Kilponen, Jouko Kangasniemi, Heikki Viitamäki, Esa Pursiheimo, Olli Paavola, Kaarlo Reipas, Göran Koreneff, Morten Kromberg, Kimmo Kekäläinen, Veli-Matti Jantunen, Timo Korpela, Ray Cannon (Missing: Anssi Seppälä)

Friday

The first talk on Friday morning was perhaps the most interesting from my point of view: Antero Ranne of the Ilmarinen Mutual Pension Insurance Company: Parallel showed how he was able to speed up financial simulations by a factor of approximately 3 on his Intel i7-based laptop, using Futures and Isolates in Dyalog version 14.0. It is really good to see that domain experts wield this tool!

After coffee, Gitte presented the work that she had done to put APL on the map as an invited speaker at a recent conference on the history of information technology in the Nordic region. She also reminded us all that we will be celebrating the 50th anniversary of the first running APL system on November 27 (http://silvermapleweb.com/first-cleanspace/). At Dyalog ’16 on October 9th-13th in Glasgow, Scotland, Dyalog will set time aside to celebrate this anniversary in collaboration with the British APL Association. If you have a good story about ground-breaking work done in APL in the early days, please get in touch and discuss how you might contribute to the celebrations!

Once again, I found myself standing between the audience and lunch – fortunately there are enough juicy language features and interfaces coming in versions 15.0 and 16.0 and I did not have anyone walk out before I was done. I even had time to talk about a workspace that we added several years ago, after discovering that several members of the audience were unaware of it: The “loaddata” workspace, which contains functions to read and write Excel Spreadsheets, CSV files, XML and ODBC data sources. If you have not seen it yet, try loading it and take a look.

After another excellent lunch, Anssi Seppälä of Enease Oy wrapped up the formal part of the programme with a talk on an inverted vectorial database implemented in the J programing language, named JD. JD makes it straightforward to manage large timeseries containing records of power usage and the quality of electricity delivered to consumers, perform analyses and generate visualisations of the data.

Several of us continued discussing programming challenges, while drinking (STRONG!!!) Finnish coffee and eating the wonderful cakes that were provided all day by Hirvihaara Manor, before heading back home after another successful FinnAPL Forest Seminar – we look forward to the 2017 edition!

Gitte and I managed to get about 40 hours at home before boarding the next plane, heading for Paris for the first French Dyalog User Meeting in recent history. More about that coming soon!

Happy New Year from the CXO!

To all our existing users, business partners and friends we have not yet met: Happy New Year from everyone at Dyalog – we hope that we can be of service to you in the year(s) to come!

But what – or who – is a CXO? Well, according to Wikipedia, chief experience officer (CXO) is the officer responsible for the overall user experience (UX) of an organization. The chief experience officer ensures the organization has good customer service, so customers are able to have a positive experience.

Since I joined the company nearly eleven years ago, the responsibility for customer experience has been an important part of my job as CTO. During this period we have grown very significantly – the five people who were responsible for Dyalog APL before the acquisition in 2005 have now become more than twenty, and we have plans to hire a couple more this year. We have reached a point where we have the manpower not only to keep existing clients happy by continuing to accelerate what has become one of the largest sustained investments in APL in the history of the language, but also to be more aggressive in going after completely new business – and attracting new generations of APL users.

As a natural consequence of this growth, we have decided that it is time to split the CTO role into two parts, with the addition of a CXO role. The CXO will focus on understanding the customer experience and what we need to do as a company to improve it, and the CTO will be responsible for implementing enhancements to the technology that we offer our users (and make sure that Dyalog itself masters the technologies that it needs to use to implement solutions today and in the decades to come).

Jay Foad appointed CTO

JayWith immediate effect, Jay Foad will assume the title of Chief Technology Officer and be responsible for the core development team at Dyalog Ltd. Jay has been with Dyalog for just over five years now, and has impressed everyone with his ability to rapidly understand almost everything that goes on under the hood. Most importantly, he combines a keen interest in the lowest levels of hardware and software, with the ability to argdiscuss the finest points of APL language theory with the likes of John Scholes and Roger Hui.

I will take the role of Chief Experience Officer and be responsible for the rest of what was the CTO role. In many ways, I will be going back to what I have been doing most of my life – working with large and small APL users to put APL technology to good use. My primary responsibility will be to make sure that Dyalog understands the needs of current and potential users and to work closely with the CTO and his team to satisfy these requirements. This is not just a question of eliminating defects and making sure that the help desk provides a good experience when users need help with our software (although that IS important). More importantly, the software needs to have the features that current and future users actually need in order to be competitive when using APL as a development tool. The features need to perform well, have decent quality and they need to be designed in such a way that each feature is not only easy to discover and use but it should ideally also be easy NOT to use, if you have no need for it.

More APL Skills at Dyalog

For the last 2-3 years, we have been moving steadily along an essentially unchanged technical road map. You can find slides and video recordings of presentations from the last many Dyalog User Meetings at http://dyalog.com/user-meetings/index.htm. Our most important goals are to:

  • continuously improve the quality of our products.
  • continuously increase performance – this includes taking advantage of parallel hardware.
  • port Dyalog APL to new platforms.
  • provide cross-platform development tools that make it straightforward to develop applications on any of the platforms we support and deploy and maintain them on any other.

During the same period, we have gradually increased our investment into adding tools written in APL, in addition to enhancing the core technology. One important change in emphasis signalled by the creation of the CXO role is that Dyalog intends to accelerate this trend and significantly increase its capacity to do programming in APL, by adding young APL developers to our staff. There are several reasons for this:

  • We need more APL developers in order to create tools, tutorials, documentation and other training materials. This is necessary to make existing users more productive and to make Dyalog an attractive tool for a new generation of users.
  • We would like to increase our capacity to engage with our existing users in order to better understand requirements and help you take advantage of new tools and language features.
  • We would like to work with new users, helping them get started with that first application implemented in Dyalog APL.
  • We want to participate in the creation of the next generation of APL “Top Guns” so that we can eventually extend our application audit, tuning and migration services.

You may be able to help us: we will be looking to place APL and core technology developers within user organisations as part of their training. If you think you could host a Dyalog developer for a few days or a week to show them what life looks like on the front lines, or you have a small APL development project that might be suitable for a young APL developer to use as a learning experience, please contact me.

Promoting APL

In addition to having the right features and tools, we need to be sure that people know about them. Over the past decades, our ability to develop new features has often exceeded our ability to produce training materials and samples for them. A significant part of the CXO role will be to work with our CEO, Gitte Christensen, to significantly increase our efforts to tell the world outside the existing APL community about the well-kept secret that is Dyalog APL.

An important goal will be to produce completely new, modern samples and training materials – including videos and regular web casts – to make it easier for both existing and new users to discover and take advantage of Dyalog APL and associated tools. We will also spend significantly more time and effort creating a presence at conferences and online forums outside the array language community.

It is going to be a busy New Year!

Posted in CXO