This works:

fun \times[u1,u2,r1,r2] (f1:u1->r1,f2:u2->r2) : u1 * u2 -> r1 * r2 => 
    fun (x1:u1,x2:u2) => f1 x1, f2 x2;


fun \otimes[D1,C1,D,C] (f1:(D1->C1), f:(D->C)) : (D1 ** D) -> (C1 ** C) =>
  fun (a:D1 ** D) : C1 ** C => match a with
   | (x1,,x) => f1 x1,,f x 
   endmatch
;

fun i2s (x:int)=>x.str+"!";
fun i2i (x:int)=>x+1;

var fs = i2s,i2i,i2s,i2s;
var r = fs.0 \otimes fs.1 \otimes (fs.2 \times fs.3);

println$ r (1,2,3,4);

But it isn't pretty. The final \times is requires as the ground case
(and need parens because of grammar issues, \otimes is right assoc).

However \prod (f,g,h) still can't be defined, i have ravel (f,g,h) in the 
library for up to 5 cases.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to