Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.lang.misc Subject: Re: type checking problem Message-ID: Date: 17 May 91 08:10:21 GMT References: <1991May16.182932.26327@kodak.kodak.com> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 33 In-Reply-To: cok@islsun.Kodak.COM's message of 16 May 91 18:29:32 GMT Nntp-Posting-Host: cdollin.hpl.hp.com David Cok asks: Here is a real-life problem which advocates of various languages/typing systems are invited to comment on. [stuff deleted] The problem is what to do with the other arguments to f. One solution is to allow creation of functions on the fly. Given, say, myf of four arguments, one would write optimum_x = optimize(myf(#1,a,b,c)) in which myf(#1,a,b,c) is a function of one argument obtained by supplying values for three of the four arguments of f. In ML, if you choose the argument order of myf right, currying will do the job. Thus we have fn myf x y z = ... expression ... ... optimise( myf X Y ) optimise is called with a one-parameter function, obtained (as it were) by ``specialising'' myf with the known values of x (ie X) and y (ie Y). Since you can write argument-jigglers easily, or use lambda-expressions, there's no problem. [ML is statically typed]. [You can do essentially the same trick in Pop11, Scheme, or Common Lisp, but they are not statically typed.] -- Regards, Kers. | "You're better off not dreaming of the things to come; Caravan: | Dreams are always ending far too soon."