>> Is there a way to test resource (cpu, mem, time) usage within J? > Yes. We traditionally use <snip/> > sTTTtt=: 7!:2@], 6!:2, 6!:2, 6!:2, 6!:2@], 6!:2@]
Thanks! I tried and found interesting to compare the two brute force proposals: the one developped by a few of us (0.4MB, 0.1ms) and Roger Hui's (1.5MB, 3ms). At first glance, I thought Roger's will be the best… Surprise! (FI, the algebraic way : 7kB, 23µs … no surprise, here) > I am not sure of the distinction you are drawing here, Probably my fault, I'm not english-native. Oops. But you answered my intended question. Well done! > J, Haskell or musical backgrounds are strongest As for now, musical > J > Haskell > However, here, what I called 'v' is a fork and the tines of a fork > both get the same arguments. <snip/> > ...here, I "just know" that in a train every odd verb (counting from > the right) sees the same arguments. The even verbs are "combining > verbs" and so of course each see something different. Oh! It's now nearly cristal clear to me. Thanks! >> 2. at first I thought I should add a & so that I got >> (57&=[+/+/) but it didn't worked as expected > > Correct. Here you have replaced the fork (57 = _:) with the hook (57&= _:) That's why I said “nearly”. I can't see the fork in (57 = _:). Or do I have to consider 57 as a verb? That's strange to me. >> I'm still trying to convert it to a function I could use directly: >> >> nfun 57 >> >> This seems a good exercice but might take me some time to solve. > > Your 'fun' is a good start, fun 29 gives you the right answer. So now > you just need to do something to convert 57 to 29. And, I think that > that thing is: divide by 2 and find the next higher integer. (Does > that help?) I'll think about how to do it. In the meantime, I solved it the algebraic way as posted previously. Thanks for everything. It's feeling like an accelerated cursus with great insights through simple problems! ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
