Hacker News new | past | comments | ask | show | jobs | submit login

This is interesting to know, because Julia uses exactly the same approach[1] (now I know where it comes from). To me it seems to be the ideal solution: use the in-place normalize!(X) where performance is important, otherwise use the more convenient allocating variant normalize(X). The exclamation mark makes it clear that the array is modified.

[1] https://docs.julialang.org/en/v1/base/collections/#Base.sum!




>(now I know where it comes from)

Both Julia and Ruby got this from Scheme and it might be even older than that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: