ÅA-DnÅAt/
のポート @ArnauldのJavaScriptの回答のので、必ず彼してください!
オンラインで試すたり、すべてのテストケースを確認してください。
説明:
ÅA # Calculate the mean of the (implicit) input
# i.e. [-3,1,4,1,5] → 1.6
- # Subtract it from each value in the (implicit) input
# i.e. [-3,1,4,1,5] and 1.6 → [-4.6,-0.6,2.4,-0.6,3.4]
D # Duplicate that list
n # Take the square of each
# i.e. [-4.6,-0.6,2.4,-0.6,3.4] → [21.16,0.36,5.76,0.36,11.56]
ÅA # Pop and calculate the mean of that list
# i.e. [21.16,0.36,5.76,0.36,11.56] → 7.84
t # Take the square-root of that
# i.e. 7.84 → 2.8
/ # And divide each value in the duplicated list with it (and output implicitly)
# i.e. [-4.6,-0.6,2.4,-0.6,3.4] and 2.8 → [-1.6428571428571428,
# -0.21428571428571433,0.8571428571428572,-0.21428571428571433,1.2142857142857144]