Hit the nail on the head. Pattern matching is more useful in languages with logic variables, or at least lisp-style lists with heads and tails. I assume (hope anyway) that WL has such, else why even bother.
Although I like the style of programming which supports such pattern matching, I have never even missed it - not even for a bit - when programming in J. Different animals, really. On 9 October 2013 16:23, Marshall Lochbaum <[email protected]> wrote: > The answer to your original question is that no, J does not employ > pattern matching in the sense it is used in WL. > > The problem with your question, and the reason many of the answers to it > are a bit confused, is that pattern matching is not a task--it is a > syntactic (and low-level semantic) language choice. Your questions treat > pattern matching as if it is a feature, and ask if J has this feature. > It's cartainly possible to translate WL code using pattern matching to > J at little cost in complexity, J simply does not use pattern matching > to accomplish the same task. It's a bit like asking how to do pointer > arithmetic in WL: WL does not use pointer arithmetic, but it doesn't > need to. > > Marshall > > On Wed, Oct 09, 2013 at 07:42:26AM -0500, Richard Gaylord wrote: > > i'm sorry that nobody seems to understand my question. i don't care about > > whether you use braces or brackets or whatever to make lists and group > > lists together or even to extract elements of lists, my question was only > > about how to do pattern matching in J. the answers i've gotten are > totally > > unintelligibe to me. perhaps that shows my ignorance of J (which i > > certainly am) but perhaps because the 'explanations' presume a > familiarity > > with the language. but i learned how to do array processing by reading > the * > > explanation in words* of the APL code in the article "Life, Nasty, > Brutish > > and Short" by McDonnell and then i simply implemented the same operations > > in WL which is an array processing language (it also uses rule-based > > methods, pattern matching, anonymous or pure functions and other > > programming methodologies or paradigms (many of which i don't like such > as > > procedural Do loops). Having taught WL for many years to both university > > students and professionals , i found it very easy to explain how WL works > > to non-programmers in very disparate different fields of science (and i > > developed and made freely available a note set on it) who then went on > > after just a few hours (< 7) of instruction to do useful things of > interest > > to them with it. there are no such resources for J. Stokes' book > "Learning > > J" is fine but it's 613 pages long and costs over $80 just to double-side > > copy and spiral bind it and it contains no practical 'real-life' examples > > of using the language to do anything substantial (in contrast to my 4 > books > > on programming in WL (or as it was previously and incorrectly referred, > > Mathematica), 3 of which use WL to write computer simulation programs for > > well-known models used in physics, chemistry, biology, sociology and > > economics. this enabled scientists in many fields to learn the language > in > > the best possible way - by seeing it applied to real problems in their > own > > fields. There are no equivalent resources for learning J, perhaps becuase > > few users of J are academicians who have the time to do it. > > i would encourage J enthusiasts to develop such resources (e.g. Data > > Science is a rapidly emerging field with not only courses, but also > degrees > > being developed and offered at many universities and and J seems like it > > would be well-suited for use in the field) unless they want to see J used > > only by a coterie of specialists in finance and such and eventually > > consigned to the heap of other discarded programming languages, as has > been > > the sad fate of APL. people like arthur whitney are content to develop > > proprietary languages for commercial use but it's a shame to see good > > concise, function-style languages such J lost amongst the garbage (i > don't > > refer to garbage collecting methods) of truly awful programming > languages. > > ken iverson well understood that a programming language carries with it a > > way of thinking and that's the REAL value of using a particular language > > (not just to make money doing financial analysis in companies).. > > my apologies for getting on a soapbox about this but to use the phrase > that > > was totally mangled by U.S. VP candidate Dan Quayle, "a programming > > language is a terrible thing to waste" and i hate to see happen to J what > > happened to APL. but since WL is widely used and once it is made into a > > stand alone inexpensive app (as was J), it will probably take over as the > > programming language of choice in many fields as it already has in the > > physical and mathematical sciences. > > anyway, thanks for trying to educate me about J but it takes more then > just > > using ascii characters to make J more teachable than APL was. but perhaps > > roger and others working with J simply don't care about getting J > accepted > > and adopted by a wider group. that's their choice but in the new era of > > computation by computer which is rapidly replacing calculation by > > mathematics, it's unfortunate. in the unforgettable words of Mae West "a > > hard man is good to find" - her sexy variant of "a good man is hard to > > find" LOL. > > > > -- > > > > *"Those who would sacrifice freedom for security deserve neither." - > > Benjamin Franklin* > > > > > > *"I think that the very notion that equations are a good approach to > > describing the natural world is a little bizarre." > > - Stephen Wolfram* > > > > * > > * > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
