sharyuwu / optimum-tilt-of-solar-panels

Other
0 stars 0 forks source link

Need help! Is this mathematical expression come out right? #47

Closed sharyuwu closed 4 years ago

sharyuwu commented 4 years ago

Hi reviewers @smiths @sorainsm @caobo1994

Sorry to call for help so frequently. I am wondering is this mathematical expression comes out right? image

I want to output a sequence so I use || symbol to concatenate two sequences which are "out" and an additional element followed symbol => And I use a conditional expression to choose which element I want to concatenate with "out". I am wondering can this expression shows readers that this function meant to recursively work from i = 0 to i = |decS|, which is the length of decS.

smiths commented 4 years ago

@sharyuwu, you cannot append to out; your output field is defining the output. A value isn't defined when you enter this access program. If you are using the notation that Ao mentioned in class, you just want concatenation to be your binary operator. In that case you don't need anything to serve the purpose of out. If you are really adding to an existing sequence, you need that sequence to be stored in a state variable that you can modify. In that case you will want one access program for the transition and another access program for the getter.

For the conditional rule (everything after the big dot), you should put the entire expression in brackets.

Rather than i being an integer, I suggest making it a natural number.

I haven't reviewed your document, but you should make sure that decS and latitude are in scope. Since they are not provided as arguments, they should be state variables.

sharyuwu commented 4 years ago

Thanks for the help. This is what I got in the end.

image image

What I am trying to do here is that I want to calculate the value from decList [i] to decList [i+diff], and then concatenate the result back to a list. The method of calculating the value is been described in the local function. I hope that separate the calculation process and the process of managing the input list can make it more readable.