CDA Computational Design and Adaptation


8
Apr/10
0

ChucK: mind-bending programming language of the day

I've recently started teaching myself a new programming language: ChucK. You can read a paper by the authors that gives a quick outline of some of the salient features of the language:
Wang, G., Cook, P. R. (2003). ChucK: a concurrent, on-the-fly audio programming language. In Proceedings of International Computer Music Conference, pages 219–226

7
Jan/10
0

Can I Get Rid of This Parameter? (Statistical tests)

I'm working on a simulation that has a bunch of parameters. It's getting a bit complicated, so I'm on a witch-hunt for unimportant parameters. The suspect in question is 'channel length.' The channel length can take any non-negative integer value. The ultimate output of the simulation is a random variable, called the 'turn taking.' (More on the details of turn taking coming soon to a journal near you.)

So the question is: does the channel length affect the turn taking?

28
Oct/09
3

pi: a pattern language

π is a new pattern-based language being developed by the Software Technology group at Technische Universität Darmstadt. In π, there's only one language construct: the pattern. Essentially, a pattern is an EBNF expression that is associated with a meaning. So when writing a π program, you're basically defining both syntax and semantics as you go. This makes it a powerful tool for defining domain-specific languages, and for experimenting with new programming language ideas.

10
Oct/09
2

SPARK Ada

SPARK is a carefully defined subset of Ada that comes with a set of tools designed to provide extremely thorough static analysis of SPARK programs. SPARK programs are annotated with additional "contract" information which are also statically checked. SPARK's analyses can detect programming errors such as improper input validation, buffer overflow errors, improper initialization, and information leaks. As a result, it's quite popular in safety-critical and high-integrity systems circles, and makes a good language for developing dependable embedded systems. Adacore has a good tutorial on SPARK that demonstrates some of the ways that SPARK can be used.

Here's a simple example of a SPARK contract for a procedure that increments some variables (derived from here):

procedure Inc (X : in out Integer);
––# global in out CallCount;
––# pre  X < Integer’Last and
––#      CallCount < Integer’Last;
––# post X = X~ + 1 and
––#      CallCount = CallCount~ + 1;

The contract specifies that

  • The parameter X and the global variable CallCount must be read by at least one path, and must be updated by at least one path through the procedure.
  • Both X and CallCount must be less than the variable Integer'Last prior to execution of the procedure.
  • Once the procedure has executed both X and CallCount must have been incremented

SPARK's static analysis tools raise an error if X or CallCount are not read or updated in any path, or if any other global variable is read or updated. Errors will also be raised if there is a possible call to the procedure that violates the precondition, or if the implementation of the procedure won't satisfy the postcondition. Note that all of these things are check statically, not as part of a dynamic check at runtime.

SPARK has been around for quite a while, and has been used in a wide range of industrial projects. So why am I bringing it up now? Because I've just found out that the SPARK language and toolset is now available under the GPL! Which makes it even easier to experiment with SPARK than it was previously.

From aim, Filed under: Programming
6
Oct/09
0

Vorpal Slot Definitions

Vorpal now has special syntax to streamline slot definition. I hope writing clear Vorpal code will be easier now.  In the past, Vorpal required a highly manual form of slot definition:

x = new()
x.a = new()
x.a.b = 2
x.a[0] = 4

No longer! Now the same result can be achieved with a nicer syntax (and slightly more efficient execution):

x = new(){
   'a' = new(){
      'b' = 2,
      4,
   },
}
29
Sep/09
0

PRETzel

PRETzel is a research group based in the ECE department at the University of Auckland. Their research focuses on the development of Precision Timed (PRET) Machines, which are processor architectures designed to give precise, deterministic execution timing. Predictable timing can be crucial for the reliable operation of embedded systems.

The PRETzel group's approach is based on augmenting an existing general purpose soft-core processor with a "predictable functional unit". Their ARPRET processors are programmed in PRET-C, an extension of C that supports synchronous concurrency, preemption, and a high-level construct for logical time. PRET-C programs are logically concurrent, but compile down to a sequential program for execution.

Berkeley and Columbia are also collaborating on the devlopment of PRET machines, although their approach is slightly different to the PRETzel one.

I'd eventually like to start doing some work with PRET machines here - either on the architecture development front, or on language design for PRET systems. Vorpal's approach to concurrency might map well onto a PRET architecture. It'd be interesting to look at how well the two approaches match, and whether Vorpal could be augmented with timing instructions.

28
Sep/09
2

Erlang, Haskell, and some thoughts on robust software design

Via Lambda the Ultimate, an interesting conversation between Simon Peyton-Jones (of Haskell fame), and Joe Armstrong (of Erlang fame). Click "show all" to read the transcript instead of watching the video.

One section I found particularly interesting is the following comment from Joe Armstrong:

JA: If you look at Haskell, Erlang, Scala and F#, what do you see? If you look at Haskell, you see something which, within its context, within the little framework it sets up for its sandbox, it's very consistent, it's very beautiful. You look at Erlang, it kind of fits, the bits fit together nicely. Of course, they don't fit together nicely with the JVM or with .NET or anything like that. If you want to use all the nice things that are there, you can't use them, or you can use them, but it's difficult. So the other approach is, you say "Let's use the JVM and target lots of different languages, so that the different languages can use each other" or you can do that within the .NET framework, you get Scala and you get F#.

The benefit there is you can use all these other things that are available, but in order to do them, you have to break them, massively corrupt and break these abstraction boundaries and I don't like that. I think you are breaking abstraction boundaries in the wrong place. How I would like to see systems built is through communicating black boxes. And I would like to see the type systems applied to the definition of the protocols themselves and I haven't seen that done.

23
Sep/09
0

Prediction + Vorpal

Here is the seminar announcement for my talk on Oct 2nd at 2:10pm.

Prediction Seminar

21
Sep/09
2

Vorpal Labeled Arguments Proposal

Here's a good discussion of how Python's named parameters and Objective-C's interspersed arguments differ:

The named parameters of Python are nice on occasion, because they allow you to specify a few out of many optional arguments, but the major benefit is that arguments can be labeled in either system. I'm sure we've all seen code like the following:


image.show(xPosition, yPosition, -1, true);

What do the last two arguments mean? Of course we could clarify by adding comments or intermediate names:

int offsetBetweenPixels = -1;
bool useOpacity = true;
image.show(xPosition, yPosition, offsetBetweenPixels, useOpacity);
image.show(xPosition, yPosition, -1 /*offsetBetweenPixels*/, true /*useOpacity*/);

Vorpal could easily support labeled arguments. The simplest implementation would take labels ending in a colon and make them part of the method name.

20
Sep/09
4

Iterated Function Systems

Fractal Flame iterated function systems are fascinating.  I've always though a simulated robot that was the iterated particle would make for a good RL problem.  Basically, the robot would be iterated in space by the IFS and it would need to learn to navigate to target locations using small forces (think of it as a waterbug in a swirling pool).

The source in C++ (requires libgd).  Here's an example of an IFS generated from a billion samples.

77