Science Fair Projects Ideas - Type signature

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 signature

A type signature defines the inputs and outputs for a function or method. Type signatures may appear to be extremely restrictive but they allow for effortless code re-use, in that given a function that performs a certain task, it can reliably be swapped with any other code that matches this type signature and the overall functionality of the entire program can be assured (given that both functions operate properly). A type signature includes the function name and the number of its parameters. In some programming languages, it may also specify the function's return type or the types of its parameters.

Haskell

A type signature in Haskell is written, generally, in the following format:

functionName :: arg1Type -> arg2Type -> ... -> argNType

Notice that the final output can be regarded as an argument. This is a consequence of currying. That is, given a function that had one arguments supplied, but takes in two inputs, the function is "curried" and becomes a function of one argument -- the one that is not supplied.

The actual type specifications can consist of an actual type, such as Integer, or a type variable that is used in parametric polymorphic functions, such as "a", or "b", or "anyType". So we can write something like:

functionName :: a -> a -> ... -> a

Since Haskell supports higher-order functions, functions can be passed as arguments, and this is written as:

functionName :: (a->a) -> a

This function takes in a function with type signature a -> a, and returns data of type "a" out.

Java

In the Java virtual machine, so-called internal type signatures are used to identify methods and classes at the level of the virtual machine code.

Example: The method String String.substring(int, int) is represented as java/lang/String/substring(II)Ljava/lang/String;

12-03-2008 10:22:39
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