Raul wrote: "I think that any time we delve into some area of computation that 
leaving and coming back after an extended absence can leave us in a jarring 
situation where we need to reacquaint ourselves with the original topic. I do 
not know of any general cure for this, finding good names for things, and good 
examples, can be fruitful." 
I have the same experience. The general cure may be: don't come back after the 
extended absence. If the problem was solved the first time then there is no 
reason for coming back, and if the problem was not solved, then new thinking 
must be made. 
- Bo



>________________________________
> Fra: Raul Miller <[email protected]>
>Til: Programming forum <[email protected]> 
>Sendt: 20:19 søndag den 26. maj 2013
>Emne: Re: [Jprogramming] Nested looping for a newbie in J
> 
>
>On Sun, May 26, 2013 at 2:01 PM, Robert Herman <[email protected]> wrote:
>> I have worked through the solution arrived at by a few of you to better
>> learn J, namely this one:
>>
>> +/,(57=x+/y+/z)*x</y*y</z
>>
>> In order to fully understand the way the matrix operations are carried out,
>> I minimized the answer space by making P = 13, and worked through the
>> output (not shown for brevity's sake) of the following input lines I placed
>> in a project file (learning the IDE with this problem too):
>>
>> P =: 13
>> x =: >:i.4
>> y =: >:x
>> z =: >:y
>>
>> 3 4 $ x,y,z
>>
>> (13=x+/y+/z)*x</y*y</z
>> +/,(13=x+/y+/z)*x</y*y</z
>>
>> +/,((13=[+/+/)*[</]*</)~i.7
>
>Since this is a rank 3 bit array, we can ask J to display it more compactly.
>
>   <"2 '.*'{~((13=[+/+/)*[</]*</)~i.7
>
>We can also use this prefix to inspect some of the intermediate results:
>   <"2 '.*'{~([</]*</)~i.7
>   <"2 '.*'{~(</)~i.7
>
>That said, some interemdiate results are not bit arrays and are
>perhaps best inspected directly:
>   (]*</)~i.7
>
>
>> Anyway, I was tempted to try and make the J program look like the Perl
>> oneby using
>> for. but I realized I was lapsing into old habits. My minimal programming
>> experience is all with imperative languages or some Lisp too. My next
>> question is how do you get the J program to print the solutions as in the
>> Perl program?
>
>That's an open-ended question, since "as in" has a contextual and case
>specific meaning.
>
>Personally, I usually try and understand intermediate results (usually
>there is only one and I can just extract an expression which computes
>it and see what it does with sample data.
>
>> In my 3 x 4 matrices of the reduced problem set, I could see
>> how the 1's in the solution selection matrix set related to the original 3
>> x 4 matrix of x, y and z rows. Without re-writing it, is there a way to
>> index the solution?
>
>I am not sure what you mean by this.
>
>I mean, of course you can index the solution, but the solution has
>only a single number.  You can also rewrite the expression which
>creates that solution and index from those results. But I feel like I
>am not understanding your question.
>
>> One question that is on my mind is the tacit vs. explicit style. I am in
>> love with the way you all distill the solution down to a tacit one-liner,
>> just as a maths formula is simplified, however, I am starting to think that
>> if and when I revisit this problem in the future, it will take a bit of
>> jarring to read it, translate it if you will. I am guessing for. loops are
>> very expensive cycle-wise and it would be just as easy to make words for
>> phrases if I wish to preserve future readability. I am getting addicted to
>> the fast way of working in the J environment, and I am grateful to all on 
>> this
>> list for sharing their wisdom.
>
>I think that any time we delve into some area of computation that
>leaving and coming back after an extended absence can leave us in a
>jarring situation where we need to reacquaint ourselves with the
>original topic. I do not know of any general cure for this, finding
>good names for things, and good examples, can be fruitful.
>
>Thanks,
>
>-- 
>Raul
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to