←back to thread

132 points zfnmxt | 1 comments | | HN request time: 0s | source
Show context
eigenspace ◴[] No.40713949[source]
I’d strongly suggest not going the Numpy route, and instead reading about broadcast in julia [1]. In many contexts, it’s very important to distinguish between the element-wise application of a function, and a function that is applied to an entire array. A classic example would be the matrix exponential[2], versus the element-wise exponential of a matrix.

In julia the former is `exp(M)`, and the latter is `exp.(M)`

[1] https://julialang.org/blog/2017/01/moredots/

[2] https://en.m.wikipedia.org/wiki/Matrix_exponential

replies(4): >>40714080 #>>40714083 #>>40714427 #>>40715920 #
rscho ◴[] No.40715920[source]
I'd strongly advise taking a page from J's book and allow rank specification for function application. Julia having ranks element and infinite is nice, but what about application row-by-row ? On on regular sub arrays?
replies(1): >>40715973 #
1. Athas ◴[] No.40715973[source]
You can just use 'map' explicitly. It doesn't have to be special syntax.