You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minor bug in getting started document at start of Section 2.2 Arrays, in the code:
function vectorMultiply(int[] vector, int[] scalar) -> int[]:
int i = 0
while i < |vector|: // needs loop invariant
vector[i] = vector[i] * scalar
i = i + 1
return vector
Scalar is defined as an array (which I assume is just a typo). I would also mention that this code does not compile even with that fixed without the loop invariant i>=0 (unless I am doing something wrong) but perhaps that is intentional (to avoid getting into that discussion so early in the document). If you are not looking yet for such trivial errors given your other work, please just ignore. :)
Really enjoying playing with this language, thanks for making it so accessible!
Thanks for pointing out the typo. Looks like I already fixed in the repository, but have not uploaded the updated PDF. Not sure why I hadn't done that --- so thanks. Fixed now.
Glad you're enjoying playing with the language. To be fair, I think I've got a lot to do yet to make it more accessible :) Are you using the online IDE? So, this version of the loop does verify in http://whileylabs.com right now:
function vectorMultiply(int[] vector, int scalar) -> int[]:
int i = 0
while i < |vector| where i >= 0: // needs loop invariant
vector[i] = vector[i] * scalar
i = i + 1
return vector
Is that roughly what you had? Was it on whileylabs that it was failing or somewhere else?
Minor bug in getting started document at start of Section 2.2 Arrays, in the code:
Scalar is defined as an array (which I assume is just a typo). I would also mention that this code does not compile even with that fixed without the loop invariant i>=0 (unless I am doing something wrong) but perhaps that is intentional (to avoid getting into that discussion so early in the document). If you are not looking yet for such trivial errors given your other work, please just ignore. :)
Really enjoying playing with this language, thanks for making it so accessible!
-Tim ([email protected])
The text was updated successfully, but these errors were encountered: