Marshall Lochbaum wrote: > [this version of] > af uses a bit refactoring to avoid having to write the case where y is empty...
Marshall I almost missed your post, just read it... I really like the way you use ^: as a replacement for recursion, but I had NO IDEA that the syntax you have used was remotely possible. Really need some more coherent documentation... First off, prepending a value before the 4:0 ??? Wow. OK I'll let that one ride... Next, ^: (* @ # @ ]) after the 4:0 ??? Brilliant, I love it, but where is it documented? (pretty please) So the above is acts as a loop, telling it how many to perform the "power" operator, yes? With any thing executable permitted as argument? Very powerful. Which brings me to my main point: I suppose all the scoping problems arose because I couldn't figure out how to express the mapping function, remember... (map (lambda (x) (af (/ num x) (remel divisors x))) Now if you look at Marshall's code, and also Raul's pretty little execution using the fork so handily ;num; (num&% af divisors&remel) &. > uniquefactors Both are making use in some form of this idiom, which I have called "verb under unbox". It seems to facilitate the mapping somehow, but I am not totally clear how this is happening. It does seem powerful though, I tried a few things interactively. Any pointers to documentation for this, or any words of wisdom? === I must say, up to now J has often impressed me, surprised me, or caused a little smile to be raised. However, working through this example and the helpful suggestions, I can say this is the first time I actually actively enjoyed it, i.e. without a feeling of repidation! Shurely shum mishtake. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
