WeixiangYan/CodeTransOcean huggingface dataset:
Task: Straddling checkerboard




Go: package main

import (
    "fmt"
    "strings"
)

func main() {
    key := `
 8752390146
 ET AON RIS
5BC/FGHJKLM
0PQD.VWXYZU`
    p := "you have put on 7.5 pounds since I saw you."
    fmt.Println(p)
    c := enc(key, p)
    fmt.Println(c)
    fmt.Println(dec(key, c))
}

func enc(bd, pt string) (ct string) {
    enc := make(map[byte]string)
    row := strings.Split(bd, "\n")[1:]
    r2d := row[2][:1]
    r3d := row[3][:1]
    for col := 1; col <= 10; col++ {
        d := string(row[0][col])
        enc[row[1][col]] = d
        enc[row[2][col]] = r2d+d
        enc[row[3][col]] = r3d+d
    }
    num := enc['/']
    delete(enc, '/')
    delete(enc, ' ')
    for i := 0; i < len(pt); i++ {
        if c := pt[i]; c <= '9' && c >= '0' {
            ct += num + string(c)
        } else {
            if c <= 'z' && c >= 'a' {
                c -= 'a'-'A'
            }
            ct += enc[c]
        }
    }
    return
}

func dec(bd, ct string) (pt string) {
    row := strings.Split(bd, "\n")[1:]
    var cx [10]int
    for i := 1; i <= 10; i++ {
        cx[row[0][i]-'0'] = i
    }
    r2d := row[2][0]-'0'
    r3d := row[3][0]-'0'
    for i := 0; i < len(ct); i++ {
        var r int
        switch d := ct[i]-'0'; d {
        case r2d:
            r = 2
        case r3d:
            r = 3
        default:
            pt += string(row[1][cx[d]])
            continue
        }
        i++
        if b := row[r][cx[ct[i]-'0']]; b == '/' {
            i++
            pt += string(ct[i])
        } else {
            pt += string(b)
        }
    }
    return
}



PHP: $key2val = ["A"=>"30", "B"=>"31", "C"=>"32", "D"=>"33", "E"=>"5", "F"=>"34", "G"=>"35",
        "H"=>"0", "I"=>"36", "J"=>"37", "K"=>"38", "L"=>"2", "M"=>"4", "."=>"78", "N"=>"39",
        "/"=>"79", "O"=>"1", "0"=>"790", "P"=>"70", "1"=>"791", "Q"=>"71", "2"=>"792",
        "R"=>"8", "3"=>"793", "S"=>"6", "4"=>"794", "T"=>"9", "5"=>"795", "U"=>"72",
        "6"=>"796", "V"=>"73", "7"=>"797", "W"=>"74", "8"=>"798", "X"=>"75", "9"=>"799",
        "Y"=>"76", "Z"=>"77"];
        
$val2key = array_flip($key2val);

function encode(string $s) : string  {
    global $key2val;
     
    $callback = function($c) use ($key2val) { return $key2val[$c] ?? ''; };

    return implode(array_map($callback, str_split(strtoupper($s))));
}
    
function decode(string $s) : string {
     global $val2key;

     $callback = function($c) use ($val2key) { return $val2key[$c] ?? ''; };
     
     preg_match_all('/79.|7.|3.|./', $s, $m);
     
     return implode(array_map($callback, $m[0]));
}   

function main($s) {
    $encoded = encode($s);
    echo $encoded;
    echo "\n";
    echo decode($encoded);    
}

main('One night-it was on the twentieth of March, 1888-I was returning');
Task: Straddling checkerboard





Java: import java.util.HashMap;
import java.util.Map;
import java.util.regex.*;

public class StraddlingCheckerboard {

    final static String[] keyvals = {"H:0", "O:1", "L:2", "M:4", "E:5", "S:6",
        "R:8", "T:9", "A:30", "B:31", "C:32", "D:33", "F:34", "G:35", "I:36",
        "J:37", "K:38", "N:39", "P:70", "Q:71", "U:72", "V:73", "W:74", "X:75",
        "Y:76", "Z:77", ".:78", "/:79", "0:790", "1:791", "2:792", "3:793",
        "4:794", "5:795", "6:796", "7:797", "8:798", "9:799"};

    final static Map<String, String> val2key = new HashMap<>();
    final static Map<String, String> key2val = new HashMap<>();

    public static void main(String[] args) {
        for (String keyval : keyvals) {
            String[] kv = keyval.split(":");
            val2key.put(kv[0], kv[1]);
            key2val.put(kv[1], kv[0]);
        }
        String enc = encode("One night-it was on the twentieth of March, "
                + "1888-I was returning");
        System.out.println(enc);
        System.out.println(decode(enc));
    }

    static String encode(String s) {
        StringBuilder sb = new StringBuilder();
        for (String c : s.toUpperCase().split("")) {
            c = val2key.get(c);
            if (c != null)
                sb.append(c);
        }
        return sb.toString();
    }

    static String decode(String s) {
        Matcher m = Pattern.compile("(79.|3.|7.|.)").matcher(s);
        StringBuilder sb = new StringBuilder();
        while (m.find()) {
            String v = key2val.get(m.group(1));
            if (v != null)
                sb.append(v);
        }
        return sb.toString();
    }
}


PHP: $key2val = ["A"=>"30", "B"=>"31", "C"=>"32", "D"=>"33", "E"=>"5", "F"=>"34", "G"=>"35",
        "H"=>"0", "I"=>"36", "J"=>"37", "K"=>"38", "L"=>"2", "M"=>"4", "."=>"78", "N"=>"39",
        "/"=>"79", "O"=>"1", "0"=>"790", "P"=>"70", "1"=>"791", "Q"=>"71", "2"=>"792",
        "R"=>"8", "3"=>"793", "S"=>"6", "4"=>"794", "T"=>"9", "5"=>"795", "U"=>"72",
        "6"=>"796", "V"=>"73", "7"=>"797", "W"=>"74", "8"=>"798", "X"=>"75", "9"=>"799",
        "Y"=>"76", "Z"=>"77"];
        
$val2key = array_flip($key2val);

function encode(string $s) : string  {
    global $key2val;
     
    $callback = function($c) use ($key2val) { return $key2val[$c] ?? ''; };

    return implode(array_map($callback, str_split(strtoupper($s))));
}
    
function decode(string $s) : string {
     global $val2key;

     $callback = function($c) use ($val2key) { return $val2key[$c] ?? ''; };
     
     preg_match_all('/79.|7.|3.|./', $s, $m);
     
     return implode(array_map($callback, $m[0]));
}   

function main($s) {
    $encoded = encode($s);
    echo $encoded;
    echo "\n";
    echo decode($encoded);    
}

main('One night-it was on the twentieth of March, 1888-I was returning');
Task: Straddling checkerboard






PHP: $key2val = ["A"=>"30", "B"=>"31", "C"=>"32", "D"=>"33", "E"=>"5", "F"=>"34", "G"=>"35",
        "H"=>"0", "I"=>"36", "J"=>"37", "K"=>"38", "L"=>"2", "M"=>"4", "."=>"78", "N"=>"39",
        "/"=>"79", "O"=>"1", "0"=>"790", "P"=>"70", "1"=>"791", "Q"=>"71", "2"=>"792",
        "R"=>"8", "3"=>"793", "S"=>"6", "4"=>"794", "T"=>"9", "5"=>"795", "U"=>"72",
        "6"=>"796", "V"=>"73", "7"=>"797", "W"=>"74", "8"=>"798", "X"=>"75", "9"=>"799",
        "Y"=>"76", "Z"=>"77"];
        
$val2key = array_flip($key2val);

function encode(string $s) : string  {
    global $key2val;
     
    $callback = function($c) use ($key2val) { return $key2val[$c] ?? ''; };

    return implode(array_map($callback, str_split(strtoupper($s))));
}
    
function decode(string $s) : string {
     global $val2key;

     $callback = function($c) use ($val2key) { return $val2key[$c] ?? ''; };
     
     preg_match_all('/79.|7.|3.|./', $s, $m);
     
     return implode(array_map($callback, $m[0]));
}   

function main($s) {
    $encoded = encode($s);
    echo $encoded;
    echo "\n";
    echo decode($encoded);    
}

main('One night-it was on the twentieth of March, 1888-I was returning');


Python: T = [["79", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
     ["",   "H", "O", "L", "",  "M", "E", "S", "",  "R", "T"],
     ["3",  "A", "B", "C", "D", "F", "G", "I", "J", "K", "N"],
     ["7",  "P", "Q", "U", "V", "W", "X", "Y", "Z", ".", "/"]]

def straddle(s):
    return "".join(L[0]+T[0][L.index(c)] for c in s.upper() for L in T if c in L)

def unstraddle(s):
    s = iter(s)
    for c in s:
        if c in [T[2][0], T[3][0]]:
            i = [T[2][0], T[3][0]].index(c)
            n = T[2 + i][T[0].index(s.next())]
            yield s.next() if n == "/" else n
        else:
            yield T[1][T[0].index(c)]

O = "One night-it was on the twentieth of March, 1888-I was returning"
print "Encoded:", straddle(O)
print "Decoded:", "".join(unstraddle(straddle(O)))
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}



C#: using System;
class Program
{
    static void Main(string[] args)
    {
        Func<int, int> outfunc = Composer<int, int, int>.Compose(functA, functB);
        Console.WriteLine(outfunc(5)); 
    }
    static int functA(int i) { return i * 10; }
    static int functB(int i) { return i + 5; }
    class Composer<A, B, C>
    {
        public static Func<C, A> Compose(Func<B, A> a, Func<C, B> b)
        {
            return delegate(C i) { return a(b(i)); };
        }
    }
}
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}


C++: #include <functional>
#include <cmath>
#include <iostream>


template <class Fun1, class Fun2>
class compose_functor :
  public std::unary_function<typename Fun2::argument_type,
                             typename Fun1::result_type>
{
protected:
  Fun1 f;
  Fun2 g;

public:
  compose_functor(const Fun1& _f, const Fun2& _g)
    : f(_f), g(_g) { }

  typename Fun1::result_type
  operator()(const typename Fun2::argument_type& x) const
  { return f(g(x)); }
};



template <class Fun1, class Fun2>
inline compose_functor<Fun1, Fun2>
compose(const Fun1& f, const Fun2& g)
{ return compose_functor<Fun1,Fun2>(f, g); }

int main() {
  std::cout << compose(std::ptr_fun(::sin), std::ptr_fun(::asin))(0.5) << std::endl;

  return 0;
}
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}




Go: 


type ffType func(float64) float64


func compose(f, g ffType) ffType {
    return func(x float64) float64 {
        return f(g(x))
    }
}
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}





Java: public class Compose {

    
    
    public interface Fun<A,B> {
        B call(A x);
    }

    public static <A,B,C> Fun<A,C> compose(final Fun<B,C> f, final Fun<A,B> g) {
        return new Fun<A,C>() {
            public C call(A x) {
                return f.call(g.call(x));
            }
        };
    }

    public static void main(String[] args) {
        Fun<Double,Double> sin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.sin(x);
            }
        };
        Fun<Double,Double> asin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.asin(x);
            }
        };

        Fun<Double,Double> sin_asin = compose(sin, asin);

        System.out.println(sin_asin.call(0.5)); 
    }
}
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}







Python: compose = lambda f, g: lambda x: f( g(x) )
Task: Function composition

C: #include <stdlib.h>


typedef struct double_to_double {
  double (*fn)(struct double_to_double *, double);
} double_to_double;

#define CALL(f, x) f->fn(f, x)



typedef struct compose_functor {
  double (*fn)(struct compose_functor *, double);
  double_to_double *f;
  double_to_double *g;
} compose_functor;

double compose_call(compose_functor *this, double x) {
  return CALL(this->f, CALL(this->g, x));
}

double_to_double *compose(double_to_double *f,
                          double_to_double *g) {
  compose_functor *result = malloc(sizeof(compose_functor));
  result->fn = &compose_call;
  result->f = f;
  result->g = g;
  return (double_to_double *)result;
}



#include <math.h>


double sin_call(double_to_double *this, double x) {
  return sin(x);
}
double asin_call(double_to_double *this, double x) {
  return asin(x);
}



#include <stdio.h>

int main() {
  double_to_double *my_sin = malloc(sizeof(double_to_double));
  my_sin->fn = &sin_call;
  double_to_double *my_asin = malloc(sizeof(double_to_double));
  my_asin->fn = &asin_call;

  double_to_double *sin_asin = compose(my_sin, my_asin);

  printf("%f\n", CALL(sin_asin, 0.5)); 

  free(sin_asin);
  free(my_sin);
  free(my_asin);

  return 0;
}








VB: option explicit
class closure

	private composition
	
	sub compose( f1, f2 )
		composition = f2 & "(" & f1 & "(p1))"
	end sub
	
	public default function apply( p1 )
		apply = eval( composition )
	end function
	
	public property get formula
		formula = composition
	end property
	
end class
Task: Function composition


C++: #include <functional>
#include <cmath>
#include <iostream>


template <class Fun1, class Fun2>
class compose_functor :
  public std::unary_function<typename Fun2::argument_type,
                             typename Fun1::result_type>
{
protected:
  Fun1 f;
  Fun2 g;

public:
  compose_functor(const Fun1& _f, const Fun2& _g)
    : f(_f), g(_g) { }

  typename Fun1::result_type
  operator()(const typename Fun2::argument_type& x) const
  { return f(g(x)); }
};



template <class Fun1, class Fun2>
inline compose_functor<Fun1, Fun2>
compose(const Fun1& f, const Fun2& g)
{ return compose_functor<Fun1,Fun2>(f, g); }

int main() {
  std::cout << compose(std::ptr_fun(::sin), std::ptr_fun(::asin))(0.5) << std::endl;

  return 0;
}




Java: public class Compose {

    
    
    public interface Fun<A,B> {
        B call(A x);
    }

    public static <A,B,C> Fun<A,C> compose(final Fun<B,C> f, final Fun<A,B> g) {
        return new Fun<A,C>() {
            public C call(A x) {
                return f.call(g.call(x));
            }
        };
    }

    public static void main(String[] args) {
        Fun<Double,Double> sin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.sin(x);
            }
        };
        Fun<Double,Double> asin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.asin(x);
            }
        };

        Fun<Double,Double> sin_asin = compose(sin, asin);

        System.out.println(sin_asin.call(0.5)); 
    }
}
Task: Function composition


C++: #include <functional>
#include <cmath>
#include <iostream>


template <class Fun1, class Fun2>
class compose_functor :
  public std::unary_function<typename Fun2::argument_type,
                             typename Fun1::result_type>
{
protected:
  Fun1 f;
  Fun2 g;

public:
  compose_functor(const Fun1& _f, const Fun2& _g)
    : f(_f), g(_g) { }

  typename Fun1::result_type
  operator()(const typename Fun2::argument_type& x) const
  { return f(g(x)); }
};



template <class Fun1, class Fun2>
inline compose_functor<Fun1, Fun2>
compose(const Fun1& f, const Fun2& g)
{ return compose_functor<Fun1,Fun2>(f, g); }

int main() {
  std::cout << compose(std::ptr_fun(::sin), std::ptr_fun(::asin))(0.5) << std::endl;

  return 0;
}







VB: option explicit
class closure

	private composition
	
	sub compose( f1, f2 )
		composition = f2 & "(" & f1 & "(p1))"
	end sub
	
	public default function apply( p1 )
		apply = eval( composition )
	end function
	
	public property get formula
		formula = composition
	end property
	
end class
Task: Function composition



C#: using System;
class Program
{
    static void Main(string[] args)
    {
        Func<int, int> outfunc = Composer<int, int, int>.Compose(functA, functB);
        Console.WriteLine(outfunc(5)); 
    }
    static int functA(int i) { return i * 10; }
    static int functB(int i) { return i + 5; }
    class Composer<A, B, C>
    {
        public static Func<C, A> Compose(Func<B, A> a, Func<C, B> b)
        {
            return delegate(C i) { return a(b(i)); };
        }
    }
}


Go: 


type ffType func(float64) float64


func compose(f, g ffType) ffType {
    return func(x float64) float64 {
        return f(g(x))
    }
}
Task: Function composition



C#: using System;
class Program
{
    static void Main(string[] args)
    {
        Func<int, int> outfunc = Composer<int, int, int>.Compose(functA, functB);
        Console.WriteLine(outfunc(5)); 
    }
    static int functA(int i) { return i * 10; }
    static int functB(int i) { return i + 5; }
    class Composer<A, B, C>
    {
        public static Func<C, A> Compose(Func<B, A> a, Func<C, B> b)
        {
            return delegate(C i) { return a(b(i)); };
        }
    }
}



Java: public class Compose {

    
    
    public interface Fun<A,B> {
        B call(A x);
    }

    public static <A,B,C> Fun<A,C> compose(final Fun<B,C> f, final Fun<A,B> g) {
        return new Fun<A,C>() {
            public C call(A x) {
                return f.call(g.call(x));
            }
        };
    }

    public static void main(String[] args) {
        Fun<Double,Double> sin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.sin(x);
            }
        };
        Fun<Double,Double> asin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.asin(x);
            }
        };

        Fun<Double,Double> sin_asin = compose(sin, asin);

        System.out.println(sin_asin.call(0.5)); 
    }
}
Task: Function composition



C#: using System;
class Program
{
    static void Main(string[] args)
    {
        Func<int, int> outfunc = Composer<int, int, int>.Compose(functA, functB);
        Console.WriteLine(outfunc(5)); 
    }
    static int functA(int i) { return i * 10; }
    static int functB(int i) { return i + 5; }
    class Composer<A, B, C>
    {
        public static Func<C, A> Compose(Func<B, A> a, Func<C, B> b)
        {
            return delegate(C i) { return a(b(i)); };
        }
    }
}






VB: option explicit
class closure

	private composition
	
	sub compose( f1, f2 )
		composition = f2 & "(" & f1 & "(p1))"
	end sub
	
	public default function apply( p1 )
		apply = eval( composition )
	end function
	
	public property get formula
		formula = composition
	end property
	
end class
Task: Function composition




Go: 


type ffType func(float64) float64


func compose(f, g ffType) ffType {
    return func(x float64) float64 {
        return f(g(x))
    }
}


Java: public class Compose {

    
    
    public interface Fun<A,B> {
        B call(A x);
    }

    public static <A,B,C> Fun<A,C> compose(final Fun<B,C> f, final Fun<A,B> g) {
        return new Fun<A,C>() {
            public C call(A x) {
                return f.call(g.call(x));
            }
        };
    }

    public static void main(String[] args) {
        Fun<Double,Double> sin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.sin(x);
            }
        };
        Fun<Double,Double> asin = new Fun<Double,Double>() {
            public Double call(Double x) {
                return Math.asin(x);
            }
        };

        Fun<Double,Double> sin_asin = compose(sin, asin);

        System.out.println(sin_asin.call(0.5)); 
    }
}