The Miser Project  

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.

Click for Blog Feed
Blog Feed

Recent Items
Whither Peano?
Miser Hacks II: A Hole to Bind Them
Petzold Annotates Turing!
Hazard Warning: Much Site Breakage I’ve just notic...
Tweaking Technorati
... feeling unlucky ...
Hanging by a Branch
Stepping Off the Edge
BlunderDome Disruption
Miser Hacks I: Floating Along the Ground

This page is powered by Blogger. Isn't yours?

visits to Miser Project pages

The nfoCentrale Blog Conclave
Millennia Antica: The Kiln Sitter's Diary
nfoWorks: Pursuing Harmony
Numbering Peano
Orcmid's Lair
Orcmid's Live Hideout
Prof. von Clueless in the Blunder Dome
Spanner Wingnut's Muddleware Lab (experimental)

nfoCentrale Associated Sites
DMA: The Document Management Alliance
DMware: Document Management Interoperability Exchange
Millennia Antica Pottery
The Miser Project
nfoCentrale: the Anchor Site
nfoWare: Information Processing Technology
nfoWorks: Tools for Document Interoperability
NuovoDoc: Design for Document System Interoperability
ODMA Interoperability Exchange
Orcmid's Lair
TROST: Open-System Trustworthiness



Hark! Is That an Idiom That I See Before Me?

"Get into a rut early: Do the same processes the same way.
Accumulate idioms. Standardize. The only difference (!) between
Shakespeare and you was the size of his idiom list
- not the size of his vocabulary."
-- Alan Perlis, Epigrams on Programming (1982)

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

N = I-(I/J)*J

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

N = I%J;

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

'(ob-B ob-B ob-B ... ob-B ob-ARG)

where there are exactly n occurrences of individual ob-B (with n = 0 OK), is equivalent to the ob

ob.c(ob-B, ob.c(ob-B, ob.c(ob-B, ... ob.c(ob-B, ob-ARG) ... )))

And that ob (called ob-n for short), taken as a program, has the useful result that

ob.ap(ob-n, x) = ob.b(ob.b(ob.b( ... (ob.b(x) ... )))

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:

ob.ap(ob-B, x) = ob.b(x)

ob.ap(ob-ARG, x) = x

ob.ap(ob.c(rator, rand), x) = ob.ev[ob.c(rator, rand), x] ob.c(rator, rand)

ob.ev[f, x] ob.c(rator, rand) = ob.ap(ob.ev[f, x] rator, ob.ev[f, x] rand)

                 -- where no exceptions to the above rule arise in this context

ob.ev[f, x] ob-B = ob-B,

ob.ev[f, x] ob-ARG = x

[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).

That is,

ob.ap(ob-n, ob-m) = ob-(m n)

where mn (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:

ob.c(ob-B, ob-n) = ob-(n+1)

ob.b(ob-n) = ob-(n ∸ 1)

and constructions that are tantamount to


      = ob-ARG, when is-singleton(x)

      = ob.c(ob-B, b-count-of(ob.b(x))), otherwise.

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

Construction Structure (Hard Hat Area) You are navigating The Miser Project.

template created 2004-05-31-22:34 -0700 (pdt) by orcmid
$$Author: Orcmid $
$$Date: 10-04-30 21:00 $
$$Revision: 22 $