Whiley / WhileyDocs

Various documents relating to the Whiley Programming Language.
7 stars 2 forks source link

Error in reverse program in WhileyCheatSheet #13

Closed utting closed 9 years ago

utting commented 9 years ago

I think the loop needs to increment the loop counter i!

(It is also not obvious to me why it mutates and returns the input list xs, instead of the copy zs?)

DavePearce commented 9 years ago

Hey,

Ok, fixed and I updated the version on the website as well --- thanks!!

Regarding the example itself. I think you're saying it would make more sense to modifiy the zs variable rather than xs? That's a pretty fair point I guess, and I don't think there is any specific reason other that, perhaps, I initially was thinking about an in place reverse.