[Swift-devel] Call function Map-Reduce

Mihael Hategan hategan at mcs.anl.gov
Tue Aug 9 16:28:45 CDT 2011


On Wed, 2011-08-10 at 01:17 +0530, Yadu Nand wrote:
> Hi,
> 
> I've been working on implementing a call function which
> would allow function calls in swift using string identifiers
> for procedures.
> 
> In order to do this we planned to use karajan's
> executeElement which I think needs a slightly different
> definition for user defined elements.
> 
> int x=5;
> (int out) old_func (int inp) {
> <body>
> }
> old_func(x);
> 
> used to translate into the following format :
> 
> 
> <element name="old_func arguments="out,inp" >
> <body>
> </element>
> 
> <old_func>
> <variable> x </variable>
> </old_func>
> 
> 
> In order to have the calls using executeElement we need
> the following style
> 
> <set name="new_func">
> <element arguments="inp">
>    ...
> </set>
> 
> <executeElement>
> <variable>new_func</variable>
> <string>inp</string>
> <executeElement>

We'll do it like this:
<executeElement name="old_func">
...
</executeElement>

> 
> 
> But how do we handle the output variable ? I don't see any
> documentation on this ?
> 

Return values are passed by reference. So y = f(x) would be
<f>
  <variable>y</variable>
  <variable>x</variable>
</f>




More information about the Swift-devel mailing list