Suggestions on syntax to express mathematical formula concisely

前端 未结 13 1115
予麋鹿
予麋鹿 2021-02-02 08:46

I am developing functional domain specific embedded language within C++ to translate formulas into working code as concisely and accurately as possible.

I posted a proto

13条回答
  •  孤街浪徒
    2021-02-02 09:10

    I would prefer a more solid separation between loops. For example, I'd prefer this alternative notation to your second example:

    sum(range(j) < N)[sum(range(i) < j)[(T(i,j) - T(j,i))/e(i+j)]]

    I also find the range syntax difficult. I think a range should be a single component. I'd prefer something like so:

    j = range_iter(0,N)

    That would open for range x(0,N); j = range.begin(); or alternatives I can't think up right now.

    You could even:

    j = range_iter(inc(0) => exc(N)); for j iterates over [0,N).

    Anyway, interesting idea. Can your resulting functions be composed? Can you request domain information?

提交回复
热议问题