4 ms·
This is wonderful. I remember using http://www.jsoftware.com/help/dictionary/vocabul.htm http://www.jsoftware.com/help/dictionary/vocabul.htm some time ago and
by 7374657068656E 12y ago
This is wonderful. I remember using http://www.jsoftware.com/help/dictionary/vocabul.htm http://www.jsoftware.com/help/dictionary/vocabul.htm some time ago and you would often have to study an entry for a long time to make {. or {: of it.
- avmich 12y agoJ manuals (J for C, I think) mention that in J array is a central object, so when you have primitive operations you have more of them, because an array allows you to do more things than a scalar. There is a set of more frequently used operations, and there are others, which provide convenient shortcuts in some cases or are useful in some relatively narrow areas. Basic operations with arrays are: {. - take the first item, {: - take the last item, }. - take everything except the first item, }: - take everything except the last item. Then there is "generalized" sorting operation /: - ascending and \: - descending, array reversal |. , you can take unique elements of array with ~. , subtract one array from another with -: and apply dyadic operation between elements of an array with / - for example, +/ 1 2 3 makes 6. You can append arrays with , - for example, 1 2 , 3 4 makes 1 2 3 4. You can "zip" arrays with ,. - 1 2 3 ,. 4 5 6 makes array of pairs 1 4, 2 5 and 3 6. Then you also have several built-in ways to partition array - using first or last element of array as separator with ;. , making prefixes or suffixes of increasing length with \ or \. , you can group elements of one array by elements of another using /. - for example, 1 1 2 3 3 4 /. 'abcdef' will produce groups ab, c, de, f . Then there is ability to combine array items with weights using #. - like, 2 hours 3 minutes and 4 seconds total 24 60 60 #. 2 3 4 -> 7384 seconds - and do that backwards with #: , get array length or filter array elements with # , get cartesian product with { ... and that's about it. Pretty powerful, well thought-out set of highly orthogonal operations. Add scalar operations - where complex numbers and arbitrary precision are built-in - and you have a good base for a universal language.