Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: Vocabulary test
- To: <tlug@example.com>
- Subject: Re: Vocabulary test
- From: "Stephen J. Turnbull" <turnbull@example.com>
- Date: Mon, 25 Sep 2000 13:35:59 +0900 (JST)
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <00ed01c024ac$82b50490$2d609a8e@example.com>
- References: <Pine.GSO.4.21.0009220021290.2923-100000@example.com><00ed01c024ac$82b50490$2d609a8e@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <_JwgvB.A.YmF.oltz5@example.com>
- Resent-Sender: tlug-request@example.com
>>>>> "David" == David Lloyd-Jones <icomm5@example.com> writes: David> I'll bite: what's a polymorphic function in English? I David> thought the whole function of functions was to return a David> single value. This is not true in Common Lisp or Python, both of which can and do return multiple values.[1] But that's not what a polymorphic function does, anyway. A polymorphic function accepts arguments of various types and "Does What I Meant" with them. Eg, printf. But a _real_ polymorphic function should be able to accept say two numbers and add them, regardless of whether they are chars, ints, floats, or bignums, without need for a format string. C++ uses static type analysis of expressions and virtual functions for this; truly object-oriented languages like LISP are able to distinguish the type of any object simply by "looking at it." Polymorphism is not quite the same thing as overloading, which allows the compiler to select the right function based on variable types, but cannot handle variables that may contain different types (eg, a C union). But the results are quite similar in many cases, and overloading is more efficient. Footnotes: [1] This may be going away in Python 2.0, if I recall the proposals correctly; Python 2.0 will explicitly require you to assign to a tuple rather than use multiple values. A typical use in Common Lisp is for functions like integer division. Normally you just get a single value, the quotient. But you can ask for multiple values using a special form, in which case division returns both the quotient and the remainder. This is not the same as returning a vector; if you assign the result of division to a variable, normally the variable contains a number, not a vector. -- University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Institute of Policy and Planning Sciences Tel/fax: +81 (298) 53-5091 _________________ _________________ _________________ _________________ What are those straight lines for? "XEmacs rules."
- References:
- Re: Vocabulary test
- From: Tod McQuillin <devin@example.com>
- Re: Vocabulary test
- From: "David Lloyd-Jones" <icomm5@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: hardware doctors!
- Next by Date: MSword reader
- Prev by thread: Re: Vocabulary test
- Next by thread: Purify type program
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links