0

Phillip Trelford's Array

 2 years ago
source link: http://trelford.com/blog/post/Byte-sized-Tweets.aspx
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Phillip Trelford's Array

POKE 36879,255

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

Background

.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;

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

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:

for i=1 to 100 do["FizzBuzz";"Buzz";"Fizz";string i].[sign(i%5)*2+sign(i%3)]|>printfn"%s"
// #fsharp code golf with @relentlessdev tonight

— Phil Trelford (@ptrelford) July 24, 2014

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

Want some good #fsharp articles to finish off the year? Check out the #fsadvent tag each day. There's a lot more coming!

String.init 9 (fun i -> sprintf "%*s/%s\\\n"(9-i)" "((String.replicate 9 "o--*-").Substring(i,i*2)))+" #fsharp || #fsadvent" pic.twitter.com/GwaFRMhYpn

— Scott Wlaschin (@ScottWlaschin) December 5, 2019

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

BBC Tweets

In 2020 the @bbcmicrobot / https://www.bbcmicrobot.com/ 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: https://virtual.bbcmic.ro/

A Christmas tree

to a Snowflake

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

Happy Christmas code tweeting…


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK