Non-deterministic J

What makes a J script non-deterministic? Answering this question would allow us to:

events

Try to make a comprehensive enumeration of asynchronous events in J:

Definitely asynchronous:

Potentially (but probably not) asynchronous:

There may be others I haven't I haven't enumerated.

arbitrary execution

Try to make a comprehensive list of sentences with a fixed, finite number of tokens which can result in the execution of arbitrary J code? (ignoring host interaction such as file reads).

The fundamental example is ". 'S' where S is J code (of arbitrary length). Consider also ". I{a. where I is a list of integers instead of characters, but again is treated as an indivisible token.

host interaction

In a perfect world, what would 9!:24[1 enforce?

Try to make a comprehensive list of effects J can have on "the outside world" (i.e. things not specified by the Dictionary). That is, what would we have to forbid to guarantee that a J script is idempotent? That it is in a tightly controlled "sandbox"?

syntax highlighting

Finally, we want to make a list of "suspect code". Suspect code is code which is non-deterministic to a static syntax analyzer (i.e. a context-free grammar). Think of things that would give a syntax highlighter trouble. For example:

   'name another'=.y
   '`name another'=.y
   another =. 'name'~
   another =. 'name' f.

What about "gerundy" operations, like ^:? They can executed arbitrary verbs which are encapsulated in finite nouns .. try to exploit this.

Consideration should also be given to the "keyword programming problem". That is, if we wanted to replace J primitives by their named "equivalents", how would we do it? Consider the example avg =. sum/ % #; should this be replaced with avg =. sum over quotient tally or avg =. plus table quotient copy? We cannot know until we know the invocation context of avg (if it's used monadically then it's the former; if dyadically, then the latter; if ambivalently, then neither; we'd have to say avg =. plus over quotient hash or somesuch.

shootout rules

Definition of tokens should be:

Token count :: Number of J words (#@;:), plus (scaled) number of atoms in specified (not computed) nouns.

Golf rules:

Make this a JAL package, with a "enforcer script" and sub-scripts for each shootout. That way users could create and test their contributions. When they're happy, they could press "submit", the Wiki would be updated, and a message would be sent to the Forum in their name (or maybe we subscribe the Forum to the RSS feeds for all Shootout/ subpages). A standard, centralized server should be used as the final authority for efficiency calibration.

Users should be able to contribute their own "shootouts" and new "corner case" test data for pre-existing shootouts. Not only time, token count, elegance, etc, should be measured, but also time of submission (in the format T+time, where T means time the shootout was posted). Each shootout should be able to completely customize its metrics (but not retroactively). It should, by default, import the constraints and metrics laid out on this page.

other discussion

Try to make a list of everywhere this has been discussed (on the Wiki, the Fora, comp.lang.apl, Vector articles, etc) and compile their ideas:

mullings

J accumulates state, and this state effects execution. See State in J. Of course, the host system has state too, and that can and most likely will effect execution. For example, 6!:0'' will never return the same value, and there is no guarantee on the output of 1!:1<'filename.ext'. Maybe some research into Monads in the Haskell sense of the word (state encapsulation).

Setting, query, J interpreter, host system.

The phrase for_name. creates a name, but like name=. and 'name'=. it is identifiable statically. Not so with )=. or )=:.

DanBron/Temp/SideEffects (last edited 2008-12-08 10:45:46 by )