Apologies to Chris - I suspect this should be Jchat....

And apologies to Geoff.  I'd be interested to know which message
proved so inscrutable - perhaps he would let me know privately
or publicly (ie via the forum).
IF Geoff's difficulty was with the maximum running sum (which I
posted on 17/4/07 under the heading "[Jprogramming] maximum
running sum - understanding scan revisited" ), I think it's worth
pointing out that (in my opinion) the result was quite important,
since
(a) the sum is useful in for example stock market price analysis
(b) provided the vector stays in memory, the approach is over
an order of magnitude faster than other already good methods.

Many Project Euler problems deliberately challenge a "brute-force" approach, and I wasn't able to solve the one I mentioned without
that new idiom.

FWIW, unlike John Randall, I don't yet have a clue how to solve
Euler problem 152...

Mike



Geoff Canyon wrote:
I learn best by doing. I don't have any pressing programming needs at the moment, so I'm not in a good position to learn a new language.

That said, I fool around at projecteuler.net. I fiddled with J a bit over the course of two weeks and solved three problems. A fourth problem I came up with code that works, but too slowly (ran for a day with no answer). I read through the primer and sections of the rest of the documentation.

In all cases I've stuck with implicit solutions. I have yet to write flow control in J, and all my solutions have ended up as one-liners. So although I feel like I've spent a lot of effort on J, so far I've managed to write five lines of code ;-)

Then Mike posted about his solution to another projecteuler problem. I studiously avoided reading his post or any of the follow-ups. Instead I looked at the problem and I had no clue. I had to retreat to my previous language to get a solution to the problem, just so I could look at Mike's code without it being cheating.

Imagine my disappointment when I couldn't even figure out the code.

Nevertheless, I've just solved a fourth projecteuler problem using J. That's the way it goes: I see a problem and realize that my limited understanding of J is sufficient, and I'm all set. But outside my understanding is completely outside my understanding.


I feel like an ancient alchemist working from a dusty tome, who can only mix up what the formulas tell him, never anything new. I look at something as simple as $,: and I don't know what it will do until I look it up. Something like:

mis =: monad def '>./(0:>.+)/\.y.,0'

is a serous puzzle.

So my question is this: how long should I expect it to take before I "get" J, at least enough that I can puzzle through other people's code without having to grab the dictionary every other symbol?

Here's my latest Project Euler code, to give you an idea where I'm at developmentally. I'm not saying which problem it solves, and it doesn't meet the 1-minute rule, but look away if you want to avoid any taint of spoilers:














+/(>/)"1 <.@(10&^.)(2 & x:) (+%)/\(1x,1000$2)

regards,

Geoff
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--No virus found in this incoming message.
Checked by AVG Free Edition.Version: 7.5.467 / Virus Database: 269.6.2/780 - Release Date: 29/04/2007 06:30


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to