[kepler-dev] Re: type signatures in the expression language

Tobin Fricke tobin at splorg.org
Fri Jul 30 11:15:56 PDT 2004


On Fri, 30 Jul 2004, Edward A Lee wrote:

> (NOTE: I wrote this reply before reading the further dialog, but the
> reply might be useful anyway...) Type designators in Ptolemy II are
> "prototypes". Any expression can be a type designator.

Yes, this is quite useful information.  Maybe it should be inserted into
the 'expressions' section of the first part of the design document?  Or
maybe it's there already, but I didn't see it.

> That said, I don't understand your example above... I would
> do something like this:
>
>     cons = function(car:double, cdr:{double}) arrayJoin({car}, cdr)

That's true if you want to have an efficient representation of lisp
paradigms.. but a cons cell in my mind is just a pair, well represented as
a record with two fields.  Nonetheless my intent wasn't to re-implement
Lisp but to construct an example to illustrate my question. (-:

> However, on quick glance, it looks like we don't have built-in
> primitives like arrayJoin... This is an oversight... We need those...
> Volunteer to create a set of such functions?

Indeed, that was my next question!  How to concatenate an array, and how
to concatenate matricies?  Do you think implementing these as 'methods' is
the way to go?  It seems '+' is overloaded to do elementwise addition, and
the matlab-esque syntax {a, b} doesn't produce {1, 2, 3, 4} but {{1, 2},
{3, 4}} -- a good thing of course.

One task I'm interested in is computing the cartesian product of two
arrays (maybe using records to represent tuples).  It seems somewhat
difficult to express this in the expression language -- I had a plan for a
recursive solution but even it required array concatenation.  Perhaps this
is something better left to an actor in the 'cal' language?   I have some
desire to do as much as possible without writing new Java actors, maybe
in part to test the expressiveness of the existing actors / languages.

Specific application: say I have an array x={double} and y={double} and I
want to produce {{x=double,y=double,z=double}} for all pairs of values
(x,y) and with z = f(x,y) for a function f.  Can/should this be described
in the expression language or should I just write the java actor?

Tobin



More information about the Kepler-dev mailing list