Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!m2c!umvlsi!dime!yodaiken From: yodaiken@chelm.cs.umass.edu (victor yodaiken) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 31,497) Message-ID: <29350@dime.cs.umass.edu> Date: 16 Apr 91 15:04:12 GMT References: <1883@optima.cs.arizona.edu> Sender: news@dime.cs.umass.edu Reply-To: yodaiken@chelm.cs.umass.edu (victor yodaiken) Organization: University of Massachusetts, Amherst Lines: 35 In article <1883@optima.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: >In article <8742@skye.cs.ed.ac.uk> Nick Rothwell writes: >] >]Now, using such general terms as "function" and "sequence" in a mathematical >]context, I assumed your were implying a homogeneous list. If you're assuming >]heterogeneous sequences, then the kind of mathematics you're dealing with >]gets more complicated than I assumed. I think. > >Why would you assume that? Math makes no distinction between >homogenous and heterogeneous lists. What complication are you talking >about? It is trivial to define a heterogeneous list in math: > >Let S be the sequence beginning with S[1] defined as follows: > if i is odd then S[i] = i > if i is even then S[i] = {i, i-1} > >It is equally trivial to define a function to act on heterogenous >elements: > >Let f x be defined as follows: > if x is an integer then x > else if x is a set then the min element of x > >All of this can be programmed directly in a language with dynamic >typing and requires extra effort in a language with static typing. >My main criterion for the expresiveness of a language is "does it let >me say what I want to directly, instead of making me work around >limitations in the language?" >-- Your example seems to involve the use of type definitions. If I now write f((1,2,3,4)) the compiler should be able to inform me that I have attempted to apply "f" to a list, but "f" is only defined on sets and integers.