Science Fair Projects Ideas - Type inference

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Type inference

Type inference is a feature present in functional programming languages such as Haskell and ML or OCaml.

Type inference automatically assigns a type signature onto a function if it is not given. In a sense, the type signature is reconstructed from the compiler/interpreter's understanding of the function's subfunctions with well defined type signatures, and thus the input/output type can be ascertained.

Example

For example, let us consider the Haskell function length, and it is defined as:

length [] = 0
length (first:rest) = 1 + length rest

From this, it is evident that the function handles lists as inputs, and the base case of this recursive function returns an integer (Haskell "Int"). So we can reliably construct a type signature

length :: [a] -> Int

Since there are no ad-hoc polymorphic subfunctions in the function definition, we can declare the function to be parametric polymorphic.

Hindley-Milner type inference algorithm

The common algorithm used to perform the type inferece is the one now commonly referred to as Hindley-Milner or Damas-Milner algorithm.

The origin of this algorithm is the type inference algorithm for the simply typed lambda calculus, which was devised by Haskell B. Curry and Robert Feys in 1958.

In 1969 Roger Hindley extended this work and proved that their algorithm always inferred the most general type.

In 1978 Robin Milner, independently of Hindley's work, provided an equivalent algorithm,

In 1985 Luis Damas finally proved that Milner's algorithm is complete and extended it to support systems with polymorphic references.

References

10-26-2009 08:16:03
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice