Ah, I see. I don't have a real good explanation. I probably started with the destructuring of the channel, and then added the :as clause later. I am in the habit of beginning each function with a 'let' clause so it's not unlikely that I reflexively pulled the turtle out there.

It's also possible that I wrote the 'assoc' statement as a single long expression that inlcuded the 'turtle/update-turtle' call, and then later extracted that function into a 'let' clause. My IDE implements that kind of refactoring very nicely.

anyway I don't remember the order in which these lines were written, nor the way in which my tests drove me to implement the function. In the end, however, you are right to point out the inconsistency. I missed an obvious refactoring.

From: jgomo3<-randymcmi... at 10/09 21:57

> As the picture shows, the `update-state` function receives an `state`. In the function's signature, you destructure `state` extracting `channel` from it. I wonder why you didn't extract also `turtle` in that moment?. You prefered to get the `turtle` explicitly in the `let` expression instead.

>

> I think it was a matter of taste, or style. Maybe related to the fact that `turtle` inside the `let` body is a derivates value from the original `turtle` you get from `state`.

CC: #[4]

CC: #[5]

Reply to this note

Please Login to reply.

Discussion

No replies yet.