comp.lang.ada
 help / color / mirror / Atom feed
From: Ehud Lamm <mslamm@mscc.huji.ac.il>
Subject: Re: Icon Co-Expressions in Ada
Date: 1998/12/17
Date: 1998-12-17T00:00:00+00:00	[thread overview]
Message-ID: <Pine.A41.3.96-heb-2.07.981217080010.70860A-100000@pluto.mscc.huji.ac.il> (raw)
In-Reply-To: uzp8n69k2.fsf@gsfc.nasa.gov

A bit about goal directed evaluation in general. Co-Expressions are really
a special mechanism, and for some reason I slumped them together in my
post.

I'll give an example of how Goal directed eval works:
Icon has a built in function find(s1,s2) which returns (potentially) all
the indexes in s2, where s1 start (find("e","ehud") should be 1).
suppose I say
if find("e","element")>1 then...

What will happen is that find will be executed, it will return 1 which
doesn't satisfy the condition, it will then be resumed, and return the
value 3. Than the "then-clause" will be executed.

For this to work from arbitrary procedures, the language provides the
suspend statement, which is like return but after which the procedure may
be resumed.(you can have a procedure say suspend 4; suspend 5; for
example).

I was thinking about implimenting this statement. Note that you ahve to
remember exactly where the computation stopped.

Co-expression are another mechanism. The allow you a limited sort of
parallel execution, of two or more procedure that can be supended. This
allows you to take one value from one routine, another from the second
routine etc.

Hopes this clears things up, a bit.

Ehud Lamm     mslamm@pluto.mscc.huji.ac.il
P.S
If any one is interested let them browse to http://www.cs.arizona.edu/icon

If anyone wants to read more, I have a litle memo called "Integrating User
Defined Procedures With Built-In Language Features: The Case of J, Icon
and C++". It deals with Icon generators (= routines that use suspend) and
other clever programming languages features. 






  parent reply	other threads:[~1998-12-17  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-16  0:00 Icon Co-Expressions in Ada Ehud Lamm
1998-12-16  0:00 ` dennison
1998-12-16  0:00 ` Stephen Leake
1998-12-16  0:00   ` Al Christians
1998-12-17  0:00   ` Ehud Lamm [this message]
1998-12-17  0:00     ` Mats Weber
1998-12-17  0:00       ` Chris Morgan
1998-12-17  0:00       ` Ehud Lamm
1998-12-17  0:00     ` Stephen Leake
1998-12-17  0:00       ` Ehud Lamm
1998-12-17  0:00   ` Mats Weber
1998-12-17  0:00     ` Ehud Lamm
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox