From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4e39e3650a0d633 X-Google-Attributes: gid103376,public From: Ehud Lamm Subject: Re: Icon Co-Expressions in Ada Date: 1998/12/17 Message-ID: #1/1 X-Deja-AN: 423193924 References: Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: The hebrew University of Jerusalem Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-12-17T00:00:00+00:00 List-Id: 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.