Hi all, I tried to implement a recursive function in Jmol 14.3.13_2015.05.07 but got strange results. In the documentation I couldn't find anything about recursive user-defined functions.
For comparison the same example is shown below in Jmol (strange results) and in Perl (expected results): ----- Jmol Example ------------------------ function recTest(level, maxLevel) { print "level=" + level + " maxLevel=" + maxLevel; if (level < maxLevel) { recTest(level + 1, maxLevel); } else { print "recursion finished at level " + level; } } recTest(1,3); level=1 maxLevel=3 level=2 maxLevel=3 level=3 maxLevel=3 recursion finished at level 3 recursion finished at level 2 recursion finished at level 1 ----- Perl Example ------------------------ sub recTest { my ($level, $maxLevel) = @_; print "level=$level maxLevel=$maxLevel\n"; if ($level < $maxLevel) { recTest($level + 1, $maxLevel); } else { print "recursion finished at level $level\n"; } } recTest(1,3); level=1 maxLevel=3 level=2 maxLevel=3 level=3 maxLevel=3 recursion finished at level 3 ------------------------------------------- Q: Is this a bug or is recursion generally not allowed? Regards, Rolf -- Rolf Huehne Postdoc Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI) Beutenbergstrasse 11 07745 Jena, Germany Phone: +49 3641 65 6205 Fax: +49 3641 65 6210 E-Mail: rhue...@fli-leibniz.de Website: http://www.fli-leibniz.de Scientific Director: Prof. Dr. K. Lenhard Rudolph Head of Administration: Dr. Daniele Barthel Chairman of Board of Trustees: Dennys Klein VAT No: DE 153 925 464 Register of Associations: No. 230296, Amtsgericht Jena Tax Number: 162/141/08228 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users