Re: Return in function
- To: mathgroup at smc.vnet.net
- Subject: [mg105781] Re: Return in function
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Fri, 18 Dec 2009 06:24:42 -0500 (EST)
- References: <hg7vac$eq9$1@smc.vnet.net>
Bill Rowe wrote: ... > =46urther, a design goal of Mathematica appears to be the ability > to do anything that is possible in Mathematics. Given that goal > and Godel's theorem, it will always be possible to generated > code which has unpredictable results. > If you truly believe this, then you probably should reconsider whether you understand Godel's theorem or the nature of finite automata (the basis of all computers). Surely there are programs that can be expressed in Mathematica that produce results that YOU can't predict, or even results that differ from machine to machine or even time to time. But these are not unpredictable. Simply build a computer than is 5% faster but otherwise operates the same. Run it and you have a prediction that is 100% right. As for the behavior of Return[], when there is no context available to return from, that has been explained by reference to Withoff's book. There are other PL, such as he-who-must-not-be-named, with more versatile constructions resembling... return_from(name_of_block,value). Mathematica's implementation seems to have replaced the situation of error-no-block-to-return-from-.... to producing a value Return[some_value]. This is appears to be a dubious choice since it is unlikely that the return, in-effect "Held" could later be "Released" with meaningful semantics in general. But the lack of adequate semantic models for parts of the language may not be as important for Mathematica as for some other languages which have to conform to some external standard. For Mathematica, there is essentially only one implementation (latest version, anyway) and it is what it is. See http://en.wikipedia.org/wiki/I_am_that_I_am (I am what/that I am) or http://www.azlyrics.com/lyrics/eminem/thewayiam.html (The Way I Am) or I yam what I yam (Popeye the Sailor Man) RJF >