Phillip Trelford's Array

POKE 36879,255

Byte-sized Tweets

This post is part of the .Net Christmas Advent calendar organized by Dustin Morris Gorski on Twitter.


.Net or dotNet is a developer platform from Microsoft from the noughties, inspired by the Java Virtual Machine (JVM) from the 1990s. Both platforms are used by millions of developers, with the JVM used primarily for Enterprise apps and Android mobile app development, and .Net again used primarily for Enterprise apps along with games on Unity.

For a practical example of Enterprise app development style check out FizzBuzz Enterprise Edition;

Both the JVM and .Net compile their code to byte code that is typically just-in-time compiled to native code at run-time, where in computer programming a byte consists of 8-bits. This was probably inspired by the 8-bit microcomputers of the 1980s 8-bit like the ZX Spectrum stored instructions in 8-bit codes that were then interpreted at runtime.

.Net and the JVM support multiple programming languages, for example on the JVM Java, Kotlin and Scala are popular and on .Net C#, F# and VB.Net are popular.

The generated byte code of the JVM and .Net allows programs to be run on different operating systems and processors, for example both can run on an Intel PC running Windows or a Raspberry Pi with an ARM chip. But things have moved on,  and it doesn't just stop at byte code anymore, code can be transpiled to run on the web as JavaScript, with libraries like Fable, or even executed in response to a Tweet...

.Net Tweets

Back in 2014 Mathias Brandewinder produced the @fsibot which lets you tweet F# code to it, and it will execute the code and return the result. This gives the programmer the power to write and execute FizzBuzz without leaving Twitter at all:

On the Advent calendar theme, this can be used to produce a Christmas tree:


This is great but the code is limited to 144 characters and the response to text only output...

BBC Tweets

In 2020 the @bbcmicrobot / a recreation 8-bit BBC microcomputer from the 1980s allowing you to tweet a full 280 characters of BBC BASIC, and with the BASIC supporting graphics programming by default, you can receive the response back as an animated GIF back! But it doesn't stop there, you can even see your programs run on a virtual BBC in 3D:

A Christmas tree

to a Snowflake


Can you write FizzBuzz in a Tweet for the BBC Micro?

Happy Christmas code tweeting…

Fable DJ Drops

This post is part of the F# Advent Calendar in English 2020 series organized by Sergey Tihon on behalf of the F# Programming Language community.

Earlier in the year I picked up a Revo radio for the DAB+ and stayed for the Internet Radio stations, that open up the world of radio, and am now tuning in using an old Raspberry Pi running Pi Music Box connected to the stereo system.

I’ve been enjoying quite a lot of Dub Reggae particularly King Dub Radio which is produced by King Dub Records based out of Marseille, France. Unfortunately it appears to be overloaded right now, so here’s another great station Real Roots Radio coming out of the UK:

To enjoy the rest of this post please crank up your volume and press play on the Internet Radio.


This month saw the official release of Fable 3 Nagareyama, Alfonso’s F# to JavaScript compiler. Fable itself has been around for a long time, and it’s been my pleasure to contribute a few games samples over the years.

Yesterday I set up and started a new project, which was very easy with only a few command line commands required to create a new project, which sits waiting for you to make changes, a bit like CodePen but running locally.

Web Audio API

The Fable Browser packages provide typed access to most of the browser Web APIs, however unfortunately the Web Audio API is not there yet, but I did find bindings in a massive file in the Fable Import project from Fable 2, which I copied and pasted from and fortunately it just worked!

The Web Audio API lets you generate sounds or play samples, and apply effects, in fact everything you need to augment your Dub, check out the Zongo Dub Siren to enjoy some real-time generated siren effects over your dub music. This is something I’d like to go deeper on in a later post.

DJ Drops

Another common part of Reggae, Dub and Dance Hall music is DJ Drops over the sound. To get some authentic Jamaican drops I commissioned Neil Hype via Fiverr, to produce 4 unique DJ Drops for your enjoyment.

Putting it all together

Follow the link to select a radio station and hit play, and hit the buttons to play seasonal drops.

Source code:

F#unctional Londoners Meetup activity

This post is part of the F# Advent Calendar in English 2017 series organized by Sergey Tihon.

A while back I used the Meetup API to build a timeline of F# Meetup events across the globe

The timeline (circa May 2016): 

You can find the source code in this Gist:

For this post I thought it would be fun to use the same Meetup API to focus in on the activity of the F#unctional Londoners Meetup group with an F# script.

The Meetup API returns a JSON response, making it an ideal place to use the FSharp.Data JSON Type Provider:

#r "../packages/FSharp.Data.2.4.3/lib/net45/FSharp.Data.dll"


let [<Literal>] auth= "&sig_id=10286388&status=past%2Cupcoming&sig=19c35f766e5b7a8cc163d2711749d8510a91de33"

let [<Literal>] url=""+auth


type Events = FSharp.Data.JsonProvider< url >

let events = Events.GetSamples()


This gives us types (and intellisense) over the JSON data, so I can make simple queries like the number of events per year:

let eventsbyYear =


    |> Seq.countBy (fun e-> e.LocalDate.Year.ToString())

    |> Seq.sortBy fst


Which returns:

Year Meetups
2010 7
2011 9
2012 11
2013 28
2014 30
2015 26
2016 17
2017 12


Next it would be interesting to get a plot, which can be easily achieved using XPlot:

#r "../packages/Google.DataTable.Net.Wrapper."

#r "../packages/XPlot.GoogleCharts.1.4.2/lib/net45/XPlot.GoogleCharts.dll"

open XPlot.GoogleCharts


let years = eventsbyYear |> Chart.Bar |> Chart.WithTitle "F#unctional Londoners Meetups"


Here’s the nice bar chart result:


And for more detail down to the day we can use a Google Calendar chart:

let options = Options(title = "F#unctional Londoners Meetups", height = 1200)

let activity=

    [for e in events -> e.LocalDate, 1] |> Chart.Calendar |> Chart.WithOptions options



The white squares indicate a meetup event:


Looking at the data, we can see there’s been a meetup almost every month since the group started back in 2010, and back in April 2016 we managed 5 events in just one month!

We can also see that there’s been slightly less meetups over the last year and a half. This roughly coincides with the fact that I stopped working in London in early 2016. To this end, if somebody who is interested in F# AND lives or works in London would like to get involved in organizing the group, then please do get in touch.

That said the show will still go on (just a little less frequently), and we have a meetup scheduled this week on Thursday 7th December with Jorge Gueorguiev Garcia on Functional Calisthenics, so please do register and come along.