Dataspace 12: AR3 to AR4, or [`] = []

Prelude:
Dataspace 11: AR2, A Better Array Representation

Okay, that didn’t quite work.

I tried to implement a Javascript parser for AR2, and it kept feeling like it was much more complicated than it ought to be. Eventually I figured out that the problem was the distinction between NIL [] and EMPTY [`]. EMPTY just… did not like existing.

So I took the plunge and added an axiom that NIL == EMPTY, calling AR2 with this axiom AR3, and everything seemed to be much better. I wrote a working Javascript parser for AR3 and it was okay-ish.

But then I started to feel that even AR3 had some problems. The main one being that it loses the array character: you can’t feed any AR3 array to a standard Javascript function that expects an array, and get a sensible result. You always have that extra cell on the end which is not part of the array.

So I took the next step, a new notation I call AR4. This one seems better.

AR4 is an array with three slots.

[Head,Body,Tail]

Head is the head (Prolog functor equivalent). It is NIL [] if the term is a List.

Body is an array. Each element of the array is an AR4.

Tail is [] or a new AR4 continuing the expression.

Then, this array can be simplified to a one- or two-slot array with a few rules:

1 If Head and Tail are both [], ie, it’s a simple proper list, it can be represented as just one slot. This is very common so we want this to be as simple as possible.

[Body]

eg

Term-expression

[1 2 3]

represents into JSON as

[[1,2,3]]

2 If Body and Tail are both [], AND if Head is an atom (a string or number), then it can be represented as just one slot. This is also a very common case.

[Head]

eg term-expression

[`true]

represents into JSON as

["true"]

3 If Tail is [] then we can drop the third slot entirely.

[Head, Body]

eg term-expression

[`foo 1 2 3]

represents into JSON as

["foo", [1, 2, 3]]

This is pretty much all there is to AR4. A couple other special-case simplification rules:

4 If both Head and Body are [], then we can reduce the whole thing to just Tail.

eg term-expression

[`[] `foo bar]

becomes

[`foo bar]

or JSON

["foo", ["bar"]]

This simplification rule is pretty important, as it means that NIL is always [].

5 If Body only has one element and it’s an atom (string or number), then we can reduce Body to its first element.

eg term-expression

[`foo bar]

becomes JSON

["foo", "bar"]

which is really just a little bit of syntax sugar for the JSON, and I’m not sure if it’s a good idea or not, but we can do it so we might as well.

Parsing up AR4 is not too much more difficult than parsing AR3, and means we can now use all standard array functions on the Body of an expression, and it’s still fairly simple to read the raw Javascript arrays.

Dividing a term-expression conceptually into a Head, a Body and a Tail also feels like a very natural thing to do, and helps explain what is going on. It’s just an array (Body) marked up with two standard added fields: the Head telling us what kind of object it is, and the Tail giving us the Lisp CDR equivalent.

Putting together both the Head and the Tail, as well as the size and random-addressable array-ness of an array Body, gives us a “tagged linked list of arrays”, which seems like it must be a fairly well understood kind of data type, but letting the tags be fully general and combining it with a standard serialisation format still seems like something that hasn’t been explored very much. We’ve had universal data types that give us a Head (objects and predicates), we’ve had universal data types that give us a tail (Lisp conses, and other forms of singly linked lists), but this is a type that includes both as standard. It’s really just a parse tree, but it’s a concrete parse tree not an abstract one.

My feeling is that this is indeed a very powerful universal data type, one that could serve as the basis of a thousand-year language, but making that argument take actual shape will be the next step.

Playlist Notes: Novas 6: The Leaves Which Tremble At Dawn Act 2

(previously in Novas 6: Act 1)

(previously in story time: Novas 6.6)

Susan and Jack, now energy beings, are assisting a parallel Earth in the braided multiverse where things are unfolding very differently because of one critical decision made by Susan’s father. And now, this world may be doomed…

Novas 6: The Leaves Which Tremble At Dawn

Act 2: Heart

To the Post Office Tower travelled countless miles of copper wire providing the power for its multiplexing amplifiers…
Continue reading “Playlist Notes: Novas 6: The Leaves Which Tremble At Dawn Act 2”

Playlist Notes: Novas 6: The Leaves Which Tremble At Dawn Act 1

(previously in story time: Novas 3)

(previously in story time: Novas 5.5 Act 1)

(previously in story time: Novas 3.3)

(previously in story time: Novas 3.4)

(previously in story time: Novas 5.5 Act 2)

(previously in story time: Novas 3.9)

Susan and Jack have left Earth, but there are many more worlds out there. Many more Earths, even.

I’ve had this one for over a year but it’s been hard to get a handle on the story. It started as a case of following the strange little riff in “Solsbury Hill” and letting the music go where it wanted. It started to paint a picture, and it definitely concluded a story that felt like it needed a coda, but it didn’t quite seem to be the future of the Novas universe. It was something else.

So I’ve let it be that something else.

It is 1999. One of the 1999s, at least. No, one of the other 1999s…

Novas 6: The Leaves Which Tremble At Dawn

Act 1: Nova

She moves like an angel and seven evening stars. Dance through the windows of her universal house…
Continue reading “Playlist Notes: Novas 6: The Leaves Which Tremble At Dawn Act 1”

Playlist Notes: Novas 0.02: A Case Of Goodbye

(previously in Program Eleven/II: Novas 0.01)

It is 1979. Susan and the other children of SKYWATCH, now calling themselves the Novas, have been on the run in the city underground, building a tentative career as punk musicians while dodging the attentions of the Center for Scientific Progress.

BEGIN PROGRAM ELEVEN/II MODULE FIVE.

Novas 0.02: A Case Of Goodbye

I can’t make up my mind what the possibilities are.
Fascinating or boring? Is this a cool world or what?
Continue reading “Playlist Notes: Novas 0.02: A Case Of Goodbye”

Playlist Notes: Novas 0.01: A Blaze Of Stars

(previously, as rationale )

(previously, as overture: Novas 0 )

(previously in Program Eleven/I: Novas 0.1 0.2 0.3 0.4 0.5 0.6 )

(previously in Program Eleven/II: Novas 1.1 2.2 3.3 )

So far there are nine entries in the “Program Eleven” series, each a playlist of eleven songs, and kicked off a year ago in honour of the Apollo 11 anniversary. Because I like big round numbers, naturally there would be two more, though I didn’t know what they’d be.

These final two entries turned out to be prequels filling in the story years 1978 and 1979, explaining how Susan ended up in the situation we find her in in Novas 5.3 – a singer alone, on the run from the sinister Company, haunted, and with mysterious memory gaps.

(A guiding image that came to me from the songs “Gloria” and “Shadows of the Night”, and which itself was part of finding a backstory to “Danseparc (Every Day It’s Tomorrow)”, where Susan just sort of appeared my head as an avatar of the 80s, *my* 80s, the decade as seen through wide preteen eyes, who’d been there all along… the New Wave singer with a kind of electrical halo of big-science strangeness about her. Was she an alien or a robot or a clone? Was she a spy or in space or in a nuclear war or in love or trapped inside a computer or leading a punk revolution? Why not all of those! What’s a story that can maximise all the sci-fi potentials? And there it began.)

(Look, it’s hard to explain my process here. I just go where my instinct seems to be pointing and then I stop when the songs seem to be the right ones. The music comes first. Then I play around with backstage story parameters until everything fits. Using songs as story modules is a randomiser, a bit like drawing cards, but it’s not completely random because they have to be songs I like.)

So now it’s the years 1960 to 1978, in that rock-opera continuum slightly ahead of ours where everything is a bit faster and neon-brighter and more Jim Steinman. But now it’s also sort of the Young Adult book version of that.

(You’ve also probably noticed by now that albums in the Eleven series with titles that start with “The” are inside the “System”, which is not quite strictly speaking always a VR simulation but more like a sort of Dollhouse kind of setup with both a simulated reality and a kind of cyborg-agent mode. And titles that start with “A” are fully outside the System, in the Real World of Novas. If not, then heads up, that’s a thing. I’ll explain later. There’ll be a little bit of retconning to do but not too much. The point is that spy adventure happens because there is spy music, and sometimes it works best for the story as simulated and sometimes it works best as real. The nuclear war happens in a simulation; the visit to the USSR happens for real, but it’s also kind of unreal because Susan (and later, Jack) keeps getting memory-wiped, because, cyborg. Except for The Day After Tomorrow. That one’s about the actual real world, popping a level up the stack. And The Earth Forever Turning is clearly Susan’s dream while she’s inside the System, but it’s actually also about the real Apollo 50th anniversary in 2019. It made sense at the time. Long story short, the Eleven series is broken into two sub-series, The and A. The A series happens outside of the computer. We are now in the A series at this point in time.)

BEGIN PROGRAM ELEVEN/II MODULE FOUR.

Novas 0.01: A Blaze Of Stars

Doctor goes into a room with a four-foot metal box. He pushes one of its buttons and he listens to it talk.
Continue reading “Playlist Notes: Novas 0.01: A Blaze Of Stars”