Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stockflows assume ternary+ operators can be expressed as distributive binary #79

Open
neonWhiteout opened this issue Aug 28, 2023 · 1 comment

Comments

@neonWhiteout
Copy link
Collaborator

image

Notice there are two f under op, when we're only applying it once.
As we don't currently expect any operands with arity > 2, not yet an issue.

@Saityi
Copy link
Collaborator

Saityi commented Aug 28, 2023

Additional info: This is currently allowed to handle how Julia represents + and * in a lisp-like way, e.g., the expression tree of v = a + b + c + d * e * f * g appears in lisp notation as (+ a b c (* d e f g)). It assumes any function with arity > 2 is one of those two and rearranges it into a form accepted as a StockAndFlowF, such as, for the previous example,

v    = a + b + c + d * e * f * g
# becomes
tmp1 = a + b
tmp2 = tmp1 + c
tmp3 = d * e
tmp4 = tmp3 * f
tmp5 = tmp4 * g
v    = tmp5 + tmp2

(or some such)

(That is to say, we do often see functions with arity > 2: + & *)

An easy solution might be to restrict when this kicks in to just specific functions, and reject anything else of arity > 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants