It has taken me some time to understand this thread: Here's a bit of what I have been thinking:
Suppose I had known this: 2 5 j./3 7 11 2j3 2j7 2j11 5j3 5j7 5j11 and I had understood the final solution that was expected: ]A=:g 1j2 _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2 I think I might if fonund this: f=: 13 :'(i:0{+.y)j./i:1{+.y' f 1j2 _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2 f ([: i: 0 { +.) j./ [: i: 1 { +. In your post of 1/25/2013 4:06 pm you mention: [1] Deriving j./&i:/@+. from ([: i: 9 o. ]) j./ ([: i: 11 o. ]) : http://www.jsoftware.com/pipermail/programming/2013-January/031131.html When I is started this thread, I struggled to understand both sides of that statement. Then I worke, often incorrectly, to move gracefully from one to the other. At some point, I understood the problem an different way to get to the solution. When the tacit solution can be simplified no further that appears to be the end of the line. But if you change the data, a new challenge emerges. f ([: i: 0 { +.) j./ [: i: 1 { +. g j./&i:/@+. What should the answer be for two complex numbers: $f 7j3 2j5 2 15 2 11 $g 7j3 2j5 2 15 11 Probably g is better, but I'm not sure. Any ideas? Linda -----Original Message----- eOn Behalf Of Dan Bron Sent: Sunday, January 20, 2013 3:20 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] [Jprogrammingou Hermitian from triangular Kip wrote: > Dan, your ic2 is very nice. > I remember trying to use +. and coming up with something much more complicated. Thanks! I honestly thought your original expression was much clearer (or legible) than the reduced version, given your intent: communicating, through code, a way to think about ordering the complex numbers. That is, it had a dual goal: being a formal, unambiguous model (executable by rote) and also a method introducing another person to the idea. In that case, repetition and redundancy are not evils: they're a key tool in education (and also in building rockets*). Anyway, I wasn't trying to present ic2 as an "improved" version of ic. I just felt inspired to write up a little essay on simplification and algebraic reduction of J programs. The fact that tacit J code is so amenable to such formal manipulation is one of its most attractive features, to me.** It's also, frankly, fun. In re: > (ic2"0 -: ic"0) Yes, this is equivalent to the penultimate line of the code you were responding to: > (ic2 -: ic)&> I like your reasoning "Monadic i: has rank 0 and for reasonable behavior I think ic and ic2 should be used with rank 0", but rather than discounting the difference in execution at rank 1 (or higher), I was (attempting to) lead the reader to discover _why_ this difference arises, perhaps using the same kind of analysis as in the exposition. It's not a very deep insight, for someone who is familiar with the language and the concepts of rank (as you immediately demonstrated by responding with a discussion of monad i:'s rank). But then, neither was the whole long essay. I'm sure most members of the Forum skipped it as trivial or tl;dr. But that's ok, because I was aiming for a different audience. Which brings me to my next point. Linda wrote: > (ic2 -: ic)"1 ,.1 2 1j2 0j2 I didn't start out with this intent, but by the end of writing the essay, I was pretty sure my audience was Linda. I know she has an aversion to verbal conjunctions (and sometimes noun conjunctions) and adverbs in general. While everyone has his own style, I find avoiding function composition, or severely limiting it, somehow misses the spirit of J (and I don't think I'm alone). And, perhaps, precludes some of the joy of working in the language. Several times, when asked, Linda has suggested that this aversion arises from the desire to keep the syntactic rules of J as simple as possible, and in particular, execute sentences right-to-left, and be able to read them left-to-right (as the original APL mostly was). My objective was to show that making J easy to read and using J's treasure of composition operations are simply not at odds. In fact, when done well, they are complementary. In order to show that, rather than simply show off the result (ic2 and its complementary left-to-right English sentence ["make the complex table..."]), I had put a little thought into what it would mean do "do it well". How you might guide someone from ic to ic2 using only simple, comprehensible changes. In particular, I was imagining a (hypothetical) Linda tutoring a (hypothetical) kid in substitution and algebraic reduction, only instead of mathematical objects and notation, using J. So that's why the language essay was so drawn out and the language so elementary. I thought it was the kind of language and methods Linda might actually use to tutor an actual kid (and meanwhile draw Linda over to the dark side of using conjunctions herself, by showing her they're not that terrible, after all). [And I'm sorry if it came across as condescending to anyone, because I didn't explain the audience I was targetting.] So, I'd be interested in reactions to that aspect of the post, particularly from Linda! -Dan * I just heard Jim Lovell speak about his experience on the Apollo 13 mission, and one concept that struck was just how critical redundancy is in reliable systems, including reliable communications. I'm pretty sure this will turn out to be a universal law (if it hasn't been codified as such already, in information theory or somewhere). ** I think John Backus made a point of the importance and utility of algebraic treatment of programs in his Turing award acceptance speech, and John Hughs certainly highlighted it in "Why Functional Programming Matters". And, of course, programming's most beloved egomaniac, Dijkstra, made a career of stumping for formal reasoning about computer programs. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm