Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick From: nick@cs.edinburgh.ac.uk (Nick Rothwell) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <8371@skye.cs.ed.ac.uk> Date: 28 Mar 91 17:32:38 GMT References: <602@optima.cs.arizona.edu> <2400035@otter.hpl.hp.com> <1991Mar27.161304.17666@daffy.cs.wisc.edu> Sender: nnews@cs.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk Organization: Tasha Yar Appreciation Soc... oh, sh*t Lines: 39 In article <1991Mar27.161304.17666@daffy.cs.wisc.edu>, quale@saavik.cs.wisc.edu (Douglas E. Quale) writes: > >typed languages are generally half to a tenth the size of programs in > >statically typed languages" Dan Bernstein reasonably writes back. > > > >] I don't believe you. Give an example. > > > > In Common Lisp, > > (defun compose (f g) > (lambda (&rest) (funcall f (apply g &rest)))) > > I think it looks better in Scheme, > > (define (compose f g) > (lambda x (f (apply g x)))) > > These definitions use dynamic typing to obtain polymorphism. ML (statically typed): fun compose (f, g) x = f(g x) This definition uses polymorphism to obtain polymorphism. BTW, I undercut you by a few characters (and several brackets). >I think it would take at least two orders of magnitude (probably three) to >do this in C. C is trashy, we know this already. Nick. -- Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcsun!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ "I see what you see: Nurse Bibs on a rubber horse."