This now works:

println$ \( \sum (1,2,3,4) \) ;
println$ \prod (1,2,3,4);


println$ \sum (1,2,3,4).darray;
println$ \prod (1,2,3,4).darray;


println$ \sum (1,2,3,4).list;
println$ \prod (1,2,3,4).list;

There are two overloads each: one for arrays and one
for streamables. The above are all arrays (including list).

If the array overload won't go, the streamable overload
can be used, however it requires the value type to be specified like

        \sum[int] ...

Of course \sum and \prod give TeX Sigma and Pi symbols :)

I will call these pure sums because they take a whole data structure
as an argument. 

Next I will try to figure out how to do indexed sums. These are 
sums over a formula with an index variable and so require
the variable initial and final values be specified. In TeX the notation is

        \sum_{i=0}^{n-1} (formula (i))

This won't quite work for Felix. Instead we have to specify the type of
the index, and, figure some way to specify the limits.

As usual programming languages are highly ambiguous but maths
is the over the top extremely ambiguous (just to confuse everyone!)

You will of course note these are just special cases of folds.
They're convenient in some limited circumstances the most
important of which is probably showing how beautiful Felix is :)

--
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