#matlab is another interesting case because its scalars are 1x1 matrices
Explore tagged Tumblr posts
pillmillipedes · 13 days ago
Text
isn't it kinda weird how, for example in julia but elsewhere too: 1 (one) [1] (one-dimensional vector of 1) (1,) (tuple of 1) fill(1) (zero-dimensional array of 1 (?))
- are all different things with different semantics?
why can't you do it the same way python deals with strings, where there is no real character type, only strings of length 1, and "s"[0] is still "s"? what am I missing here? what am I missing here?
(besides optimization concerns ofc - languages don't optimize [1] because they have 1 - you can still store [1] as a scalar, it's just a (more consistent?) abstraction you would present to the user)
thinking about arrays, as usual.
3 notes · View notes