G'day Below is an expensive method to compute powers of 8:
RecFor =: 3 : 0 if. y = 0 do. z =. 1 else. z =. 0 for_i. i.8 do. z =. z + RecFor y-1 end. end. z ) RecFor 6 262144 The concerning thing is about the amount of memory required for this: 7!:2 'RecFor 6' 38352128 7!:2 'RecFor 7' 306788160 7!:2 'RecFor 8' 2454272384 This happens in linux; I didn't try it in Windows at the office because of lockdown. If I do this several times, the task (as seen in top) gets bigger and bigger. Looks like a genuine memory leak, doesn't it? As far as I can see this happens only when combining a recursive verb and a for loop -- not when using either of those separately (but that makes it even more mysterious to me). JVERSION Engine: j903/j64avx2/linux Beta-k: commercial/2021-05-30T16:05:35 Library: 9.03.06 Qt IDE: 1.9.2/5.9.5(5.12.8) Platform: Linux 64 Installer: J903 install InstallPath: /home/ben/j903 Contact: www.jsoftware.com The good news is that I still have 902 around: 7!:2 'RecFor 5' 9344 7!:2 'RecFor 6' 11008 7!:2 'RecFor 7' 12672 I suppose the small increase is now due to the stack size, is it? Greetings, Ben ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
