News for hackers. Stuff that matters.
Re:ELI – A System for Programming with Arrays by yummyfajitas on Tuesday December 16, 2014 @08:45AM (#8757058)
Not all APL-like languages do the conciseness thing. Numpy doesn't. Recently a colleague had some imperative code for computing a specific random variable (average revenue given a certain product selection process). Roughly speaking, the for-loop you expect. In code review I changed it to:

    revs = dot(dirichlet(alpha, NUM_SAMPLES), rev_by_category)
Net result - this draws NUM_SAMPLES dirichlet vectors, dots them with the rev_by_category vector, and generates a list of NUM_SAMPLES of the corresponding random variable.

Or:

    total_variation = var(data.flatten())
    first_axis_var = var(mean(data, axis=0))
    second_axis_var = var(mean(data, axis=1))
From what I understand, this is definitely idiomatic J translated to Python. In general, idiomatic numpy code will always be array oriented since that's (until recently) the only way to shell out to C.

So from what I can tell, APL isn't dead. It's just spelled out in easy to read executable pseudocode.

There are no comments on this comment yet.