coffeescript how to unpack like "tuples" in python
coffeescript
Solution
This is the best code I could come up with.
@cosines = [0,1,0]
rot = @branch.rotation
[rot.x, rot.y, rot.z] = [Math.asin(c) for c in @cosines]
The unpacking destructuring is the same as in Python, but with square brackets.
Problem
I'm new to coffeescript. Is there a way to take these three lines setting the rotation and accomplish the same thing, like you would do in python by unpacking a tuple? ``` @cosines = [0,1,0] @branch.rotation.x = Math.asin(@cosines.x) @branch.rotation.y = Math.asin(@cosines.y) @branch.rotation.z = Math.asin(@cosines.z) ```