Collaborative articulation of how abstraction and language is employed in the computational manifestation of numbers -- including analysis of the role of syntax, semantics, and meaning in the specification and use of software interfaces.
The nfoCentrale Blog Conclave
nfoCentrale Associated Sites
I mentioned, in Miser Hacks II, that I fancy having abundant idiomatic usage of the Miser Ob structures and the constants that elicit particular operations of the standard Miser machine. This was my justification for having the primitive functions on obs be total in Miser Hacks I.
This is a desirable quality of a machine-language organization and design: having instructions and fundamental data elements that can be used in a variety of ways that allow introduction of unexpected computational flexibility. And, as a practical development, oMiser is a synthetic computing machine. Even though it is constructed atop a conventional digital computer platform, attention to the opportunity for valuable idioms in the "machine language" for Miser matters from the standpoint of economical expression and efficiency of operation.
Alan Perlis woke me up to idioms in programming in a conference-break conversation about work on APL idioms reported with one of his students. In this case, the language was APL, a language whose functional and operator characteristics provided an abundance (including map-reduce and others) of the kind we seek for Miser programming.
A common idiom, one that programmers of the earlier Fortran systems knew by heart is on the lines of the statement
for computing the remainder of the division of I by J. I'm not going to explain this beyond pointing out that it once worked in Python and it still works in C and C++ except now we have the more-explicit
There are many programming idioms and they are to be treasured. As one can see, idioms can cost something in understandability. Yet when you know the idiom, you can spot it's usage immediately. One which I use regularly is
for the number of containers of size J that are required to hold I objects.
In a way, programming-language idioms (including machine-language ones) are miniature implementation patterns for common situations. They presage the higher-level understanding of design patterns and they are a significant element in fluency of master programmers.
An example of an idiom in oMiser is a common choice for representing small numbers. In Frugalese, the structure
where there are exactly n occurrences of individual ob-B (with n = 0 OK), is equivalent to the ob
And that ob (called ob-n for short), taken as a program, has the useful result that
where there are exactly n ob.b operations on the right. For those playing along at home, here are related characteristics that are part of why it works that way:
[Update 2007-11-29: I realized that the original brief sequence was a little too brief. I added some intermediate steps and adjusted the notation a little to at least make this coherent no matter how opaque it remains. I will provide a more-complete definition of ob.ap(f, x) in a forthcoming post, and the "Frugalese" notation being used will also be unfolded in later posts.]
That is, the structure, ob-n is a program (or a sequence) of n ob.c's that has the effect of diminishing any ob (treated as a sequence) by removing the first n beads but no more than there are. Because all singletons have ob.b(x) = x, the technique is assured not to remove a terminal singleton (such as the ob-ARG individual at the end of some ob-m).
where m ∸ n (read: m dot-minus n) is the diminish operation for non-negative natural numbers, resulting in max(0, m-n). [Note: dot-minus is a special Unicode character that may not render in your browser. See if it makes a difference to force the encoding to be understood as Unicode UTF-8.]
This is part of a Miser idiom for small numbers and using them for counting down (and decapitating obs taken as sequences). So we will often see operations of the following sort:
and constructions that are tantamount to
When you consider how unnatural Miser is as even a machine language, it is no wonder that without little idioms that are easily reused (and Miser makes reuse amazingly easy) no programs of reasonable complexity could be created "by hand", as when creating the first programs for making writing the programs easier.
Because oMiser is such a rudimentary applicative system, kept that way to see how we can first comprehend and then transcend its puristic sandbox with xMiser extensions, it is appropriate to end with another Perlis epigram (but not the last word on the subject):
"Purely applicative languages are poorly applicable."
[update 2007-11-29: I added some intermediate steps in the ob.ap process so that the evaluation of an ob-n application can be followed, although the unfamiliarity of the Frugalese notation may take some giving up of preconceptions about how to read these formulas. I have to reread them regularly to remind myself that I got it right, and that is what led to this "improvement." I also tweaked one of my sentences about the value of idioms, because I was here and I could.]
|You are navigating The Miser Project.|