Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!stanford.edu!agate!ucbvax!ENUXHA.EAS.ASU.EDU!surendar From: surendar@ENUXHA.EAS.ASU.EDU (Surendar Chandra) Newsgroups: comp.lang.functional Subject: Help needed with behaviour of SML Keywords: SML, Variable redefinition Message-ID: <9104262016.AA28063@enuxha.eas.asu.edu> Date: 26 Apr 91 20:16:38 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: surendar@enuxha.eas.asu.edu (Surendar Chandra ) Organization: Arizona State Univ, Tempe AZ Lines: 27 Hi, This is my first posting on this group. I do not even know if this question is appropriate in this group. Anyway, I am currently implementing a subset of the STandard ML as part of my course project and find the behavior of SML quite confusing in the following case. > val a = 1; > a ; | 1 : int ; > fun b c = c * a ; > b 2 ; | 2 : int ; > val a = 3; > b 2 ; | 2 : int ; ^^^^^^^^^^ Why does it do it like this.. Why doesn't it look up at the current value of the variable 'a'. Why does it store the current value of 'a' in the function during compilation itself? WHat is the logic behind this? I could not lay my hands on a good reference for SML and most of the books don't seem to talk about this at all. Thanks in advance for any help, surendar ============================================================================ Surendar Chandra 602-894-2614 surendar@enuxva.eas.asu.edu