Eno: Another Data Markup Language

Eno seems interesting. I don’t know that it’s interesting enough to exist over existing formats, but it’s in the YAML/Config format/TOML family and sort of a cousin to Markdown/Settext/Wikiformat (as all these data formats are).

It doesn’t seem to have a spec per se and the documentation is silent about primitive datatypes, which is annoying. Looking at the Python library’s documentation suggests that it uses an on demand coercion approach…basically, you coerce an element when you retrieve it from the parsed structure:

>>> from enopy import loaders, parse

>>> doc = parse("""
...   publish: yes
...   location: 36.987094, -25.091719
...   contact: contact@faulty
... """)

>>> doc.boolean('publish')
>>> doc.lat_lng('location')
{ 'lat':  36.987094, 'lng': -25.091719 }
>>> doc.email('contact')
ValidationError: 'contact' must contain a valid email address, for instance 'jane.doe@eno-lang.org'.

I can’t say I’m a big fan of this API. It seems really dreadful to have the field name as a string inside a coercing function call on the document which magically gets the right “loaders”? I mean, you have to specify the type of everything including built in structured types? Yeek.

Ok there does seem to be a generic interface:

>>> document = enopy.parse(input)

>>> document.element('title')
<class Field name="title" value="Artfest 2018">
>>> document.element('tags')
<class List name="tags" items=2>
>>> document.element('content')
<class Section name="content" items=14>

This feels like a step back from e.g. JSON. And this documentation hurts me!

Still, it’s kinda interesting and one could always layer a different API on top.


Worksheets to Support Active Learning

I do a lot of lecturing. I like to lecture and am good at it. It also is pretty much what’s expected. For MSc classes we have all day classes which kinda suck for lectures though that’s mostly what we do. For my software engineering class, I break up the day with two labs, which helps, but I’m always on the look out for ways to make the lectures more effective. This generally means trying to get the students to do active learning, that is, not to passively “receive” information…this is nearly worthless…but to anticipate, question, puzzle over, generally be engaged in the material I’m presenting. Student response systems seem to help some with this as does asking questions of the class (though this often fails). Our students are of wide ranging abilities and backgrounds. For many, just working in English is a big strain.

One thing I’ve had what I think of as some success with is providing little, simple activities on sheets of paper, e.g., to draw various complexity curves. It’s a variant of clicker questions, but trying to get them to do something.

I came across a Software Carpentry blog post on Git worksheets which intrigued me. The idea there is to “draw along” with the instructor instead of doing some task. It seems a nice way to provoke and support the good sort of note taking. I have a lot of “process style” slides which I maybe can change into worksheets or have anticipatory worksheets. I draw a lot on the board spontaneously, but perhaps using the opaque projector on a worksheet might be more effective (though take a lot more prep).

Support for Contact Theory

There’s an intriguing post by Echidne about a paper about an experiment on the effects of gender integration on men’s attitudes toward women. This chime’s with other stuff I’ve read esp about thresholds for participation which trigger changes in climate (I really need to go back and dig all those up and put them in one place). Interestingly, Echidne speculates that the quality of the contact is also key:

The first sentence is crucial of course, and so is, in my opinion, the clear sharing of same tasks in an observable manner.  It’s not enough that men and women are in close contact, the way many of us are in our homes or at least in our childhood homes, say.

The work must be shared so that the skills and effort of each contributor become evident to the others.  Many traditionally female chores at home (cleaning, laundry) can become almost invisible (as work) to those family members who are not doing them when sexual division of labor is rigid, and it may be hard to value the work someone is doing if it appears to just happen in the background of life.

I find this highly plausible. And it points not just for the need for women in leadership positions but in all positions. And it’s ever more important to make sure that they don’t get stuck with ghettoisable tasks.

Cranky Pants Wirth

I love Niklaus Wirth’s work. I read his compiler constructor book and it was so beautiful and make computer science seem so elegant…it’s why I ask my PhD students about the Chomsky Hierarchy to this day. I thought the Oberon system was very neat (esp the S3 spin off).

But damn he can make a lot of undersupported claims in a short text. “A Plea for Lean Software” is a fun, cranky polemic but the 9 lessons learned are a big pile of “because I say so”. Eg lesson number one is that the speed the “complex” Oberon system was developed depended on having a strong and statically/manifestly typed language. Ok! I’m convinced! Well, no, I’m not convinced 😉 I’m willing to bet that it has a lot to do with having a genius programmer/system designer who could do exactly what he wanted with no compatibility issues or external constraints to face.

I think life and computer science are better now. We know more and more of what we don’t. People still make these gonzo claims but they don’t go quite as far.

I hope.

I still love reading it though.

Are Tuplespaces That Much Better?

I remember reading about Linda (and thus tuplespaces) back in the day and loving it. It seemed really cool, elegant, simple and likely effective way of doing distributed programming. It is really easy to add to existing programming languages. And it essentially never took off. Greg Wilson thinks this is a big loss:

It’s easy, easy, easy for beginners to understand—much easier than MPI. And compile-time analysis of tuple in/out patterns can make it run efficiently in most cases; adhering to some simple patterns can help too. But for a whole bunch of reasons, it never really took off: not as a language extension to C, not as JavaSpaces, not in various homebrew implementations for agile languages like Python, and that makes me sad. It’s as if the metric system had failed, and we had to do physics with foot-acres and what-not. But I guess that’s the world we live in…

Is it really that dramatic? How would we tell? What’s the analysis like?

The thing about tuplespaces is that it is straightforward to add them to just about any system. So….why don’t people who know about them just use them?

This just might be a good MSc project!

Rockstar Rainfall Problem

I had to write a Rockstar program. FizzBuzz was done so I decided to try the Rainfall Problem:

Write a program that will read in integers and output their average. Stop reading when the value 99999 is input.

Here’s my program:

My hopes are nothing
The future is nothing without my hopes

Listen to the sky
Until the sky is decimated, destroyed; sparkling, sinuously perfected
Build my hopes up
My dreams are the sky with the future
They are my dreams
Listen to the sky

If my hopes ain't nothing
shout the future over my hopes

If my hopes are nothing
whisper the future of my hopes

It’s damn tricky! The first block initialised the counter (my hopes) and the sum (the future) to zero (nothing). I subtracted zero from zero for the second line to add a little variation.

Getting 99999 so it would scan and make sense was very hard. I don’t think it quite worked, but it’s not an unbearable stretch. Rather too much alliteration.

The averaging sounds a bit odd. I did guard against no input, yay!

Unfortunately the Python transpiler isn’t very complete. Here’s the raw output:

my_hopes are False
the_future = False - my_hopes
the_sky = input()
while not the_sky == decimated, destroyed; sparkling, sinuously perfected:
    my_hopes += 1
    my_dreams are the_sky + the_future
    They are my_dreams
    the_sky = input()
if my_hopes != False:
    shout the_future / my_hopes
if my_hopes are False:
    whisper False

So, it doesn’t understand are or nothing properly and doesn’t handle poetic number literals. Easy enough to hand fix:

my_hopes = 0
the_future = 0 - my_hopes
the_sky = int(input())
while not the_sky == 99999:
    my_hopes += 1
    my_dreams = the_sky + the_future
    the_future = my_dreams
    the_sky = int(input())
if my_hopes != 0:
    print(the_future / my_hopes)
if my_hopes == 0:

Note that since Python 3.x replaced input with raw_input (and threw away Python 2.x’s input, I had to add a manual cast around the read. I think the semantics of Rockstar’s listen has to be more like old input otherwise you couldn’t input numbers.

Anyway! There you go!

(I didn’t filter negative numbers since the problem as stated in the linked paper puts that as an elaboration. That would be a PITA to handle :))

It’s clear that there needs to be more synonyms and esp “null” words i.e., words which just get dropped.

The Rockstar Programming Language


I mean check out the FizzBuzz example:

Midnight takes your heart and your soul
While your heart is as high as your soul
Put your heart without your soul into your heart

Give back your heart

Desire is a lovestruck ladykiller
My world is nothing
Fire is ice
Hate is water
Until my world is Desire,
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing
Shout "FizzBuzz!"
Take it to the top

If Midnight taking my world, Fire is nothing
Shout "Fizz!"
Take it to the top

If Midnight taking my world, Hate is nothing
Say "Buzz!"
Take it to the top

Whisper my world

Here’s that code run through a Rockstar to Python transpiler:

def Midnight(your_heart, your_soul):
    while your_heart >= your_soul:
    your_heart = your_heart - your_soul
    return your_heart

Desire = 100
my_world = False
Fire = 3
Hate = 5
while not my_world == Desire:
    my_world += 1
    if Midnight(my_world, Fire) == False and Midnight(my_world, Hate) == False:
    if Midnight(my_world, Fire) == False:
    if Midnight(my_world, Hate) == False:

That’s not bad! Of course, changing the problem definition from “FizzBuzz” to “Fuck you” is waaaay more rock n’ roll (and funny).

Interestingly, the “minimal Rockstar” version (i.e., using only basic features and programming oriented variable names) isn’t terrible:

Modulus takes Number and Divisor
While Number is as high as Divisor
Put Number minus Divisor into Number
(blank line ending While block)
Give back Number
(blank line ending function declaration)
Limit is 100
Counter is 0
Fizz is 3
Buzz is 5
Until Counter is Limit
Build Counter up
If Modulus taking Counter, Fizz is 0 and Modulus taking Counter, Buzz is 0
Say "FizzBuzz!"
(blank line ending 'If' Block)
If Modulus taking Counter and Fizz is 0
Say "Fizz!"
(blank line ending 'If' Block)
If Modulus taking Counter and Buzz is 0
Say "Buzz!"
(blank line ending 'If' Block)
Say Counter
(EOL ending Until block)

Indeed, it’s basically verbose Python.

My favourite part is the “poetic” syntax for number literals. This is where the magic happens:

A poetic number literal begins with a variable name, followed by the keyword is, or the aliases was or were. As long as the next symbol is not a reserved keyword, the rest of the line is treated as a decimal number in which the values of consecutive digits are given by the lengths of the subsequent barewords, up until the end of the line. To allow the digit zero, and to compensate for a lack of suitably rock’n’roll 1- and 2-letter words, word lengths are parsed modulo 10. A period (.) character denotes a decimal place. Other than the first period, any non-alphabetical characters are ignored.

That’s crazy! Consider the first example: Tommy was a lovestruck ladykiller. Tommy is the variable, was is an alias for the assignment operator. The rest of the line is a numeric literal. a has length 1, so it represents the digit 1. lovestruck and ladykiller each have length 10, so given that 10 mod 10 is 0 each represent a 0. Thus the whole line assigns 100 to Tommy.

Love it!

It’d be interesting to design a folk variant.