Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!gatech!mcnc!uvaarpa!murdoch!clas01!heddle From: heddle@clas01.cebaf.gov (David Heddle) Newsgroups: comp.sys.mac.programmer Subject: Passing Fuctions Keywords: ThinkPascal Message-ID: <1991Apr30.194745.623@murdoch.acc.Virginia.EDU> Date: 30 Apr 91 19:47:45 GMT Sender: usenet@murdoch.acc.Virginia.EDU Reply-To: heddle@clas01.cebaf.gov (David Heddle) Organization: CEBAF (Continuous Electron Beam Accelerator Facility) Lines: 35 Dear Friends: Can anybody supply an example of Think Pascal code wherein one passes a function? For example, suppose I want to write an integration routine which accepts the integrand as an argument: function Integrate(integrand:ProcPtr; LowerLimit:real; UpperLimit:real):real; begin end; How do I implement a function that can be passed into "integrand"? For simplicity, assume it is a real function of one real variable. What I'd like to do is something like: function ComplicatedFunction(x:real):real; begin end; and then call via: Result := Integrate(@ComplicatedFunction, 0.0, 1.0); but it doesn't work. Is it possible that I must use assembly language? If so, does anyone have an example I can cannibalize? cheers, dph