In my head the programming language used on the Teletype has always been a bit Lisp-ish, but without the brackets, after all it does use Polish (a.k.a. prefix) notation.
Anyway, a few weeks back I came across an AMA on Reddit with Olivier Gillet (pichenettes) from Mutable Instruments. It had this (rather sweet) quote in it:
Thank you for taking time to do this. Are there any modules from other makers where you have thought “fuck, why didn’t I come up with that”?
A Monome Teletype running Forth.
I don’t know much at all about Forth, I have discovered that it is a stack based programming language using reverse Polish notation (a.k.a. RPN, a.k.a. postfix). This chimes with what I know about how the code works internally, even though we enter code in prefix notation, it’s actually run as if it’s in postfix notation. So in fact in turns out that the Teletype is backwards Forth, hence my appalling abuse of Unicode for the post title (it was either that or some pun based on a Shakespearian insult).
(as an aside I’ve also discovered RPL which is a programming language for HP calculators and appears to be a mash up of Forth and Lisp.)
Now I’m all at sea when it comes to RPN, I never had a HP48/49 calculator at school. So even trying to read Forth code makes my head fuzz a little. With that said I am looking for inspiration for ideas to enhance the Teletype programming language, and maybe learning a bit of Forth might be the way.
(another aside, I now have an unwanted desire to buy an HP50g and use it’s USB port to send messages to Ansible to generate CV.)
The first major change I’d like to introduce is the idea of multiple statements per line via a
; separator. E.g.
X 1 ; Y 2 ; Z 3 ;
would be equivalent to:
X 1 Y 2 Z 3
This would be particularly useful in
I scripts, and would serve as a (complementary) alternative to the timelines functionality proposed. Technically it should be much much easier to implement compared to timelines.
Naturally there are a few hiccups…
L 0 10 : PN 0 I I ; PN 1 I MUL 2 I
This could be interpreted 2 ways, i.e. which separator has more significance. Demonstrated with parentheses below
L 0 10 : (PN 0 I I ; PN 1 I MUL 2 I) # option 1 (L 0 10 : PN 0 I I ); PN 1 I MUL 2 I # option 2
I favour option 1.
X PARAM ; IF LT 100 X : TR.PULSE 0
Should we allow this? It’s only 1 pre statement…
Thoughts? Can anyone spot any other edge cases? (Does anyone have an HP RPN graphing calculator to send me and derail my plans for 2017.)