J can look like APL or English
DRANK

J can also be written like English. The primitives addon for J assigns English aliases for all of J's symbolic primitives. You can also define new aliases freely.The following is an English translation of the k-means clustering code in J. The functions are defined in a point-free style, which tends to be idiomatic in J, so no intermediate variables are actually declared - the primitive functions are instead composed together similar to pure functional programming in other languages.First, the primitives addon is loaded and the following convenience aliases are defined. These are general enough that these could go in a utilities script.load 'primitives' fold =: insert sum =: plus fold minimum =: min fold mean =: sum divide tally vectors =: rank 1 then =: conjunction : ' v at u' groupby =: dyad : 'y (box key) x' K-means clustering can then be expressed with the following J code.kmc =: right (step power infinity) initialise initialise =: (left deal tally at right) from right step =: (lef…

wjmn.github.io
Related Topics: Functional Programming