Re:Taichi Lang
by packetlost on Thursday March 09, 2023 @05:35PM
(#35087812)
I wouldn't consider Julia a replacement for Python
[ Parent
| on HN ]
Re:Taichi Lang
by Iwan-Zotow on Thursday March 09, 2023 @08:07PM
(#35089190)
and its an ugly thing
they didn't get range composition right
care to elaborate
Re:Taichi Lang
by Iwan-Zotow on Friday March 10, 2023 @08:21PM
(#35103991)
In C and Python (which inherited it from C, I believe)
for(int k = 0; k != N; ++k) { dowork(k); }, similar in Python
ranges are [0...N). If I want just a sum, and would like to split work among multiple CPUs, I could write
s = sum(0...N) or s = sum(0...N/2) + sum(N/2...N) or s = sum(0...N/3) + sum(N/3...5N/7) + sum(5N/7...N)
and it will work beautifully. Ranges are decomposable and composable with any number(s) splitting original range.
[0...N/2) + [N/2...N) = [0...N)
When I first looked at Julia, I was ... unhappy. They didn't get simple ranges composability right. You could do it, sure, but it looks so ... unnnatural.
Re:Taichi Lang
by packetlost on Friday March 10, 2023 @10:25AM
(#35095500)
1 indexed arrays has me confused as hell
Re:Taichi Lang
by Iwan-Zotow on Friday March 10, 2023 @08:23PM
(#35104008)
yep, part of the problem