_D_e_f_i_n_i_t_i_o_n_s The purpose of a definition is to give a value to one or more variables. There are two kinds of definition, `scalar' and `conformal'. A scalar definition gives a value to a single variable, and consists of one or more consecutive equations of the form fnform = rhs where a `fnform' consists of the name being defined followed by zero or more formal parameters. Here are three examples of scalar definitions, of `answer', `sqdiff' and `equal' respectively answer = 42 sqdiff a b = a^2 - b^2 equal a a = True equal a b = False When a scalar definition consists of more than one equation, the order of the equations can be significant, as the last example shows. (Notice that `equals' as defined here is a function of two arguments with the same action as the built in `=' operator of boolean expressions.) A conformal definition gives values to several variables simultaneously and is an equation of the form pattern = rhs An example of this kind of definition is (x,y,z) = ploggle For this to make sense, the value of `ploggle' must of course be a 3-tuple. More information about the _p_a_t_t_e_r_n _m_a_t_c_h_i_n_g aspect of definitions is given in the manual section of that name. Both fnform and pattern equations share a common notion of `right hand side' _R_i_g_h_t_ _h_a_n_d_ _s_i_d_e_s The simplest form of rhs is just an expression (as in all the equations above). It is also possible to give several alternative expressions, distinguished by guards. A guard consists of the word `if' followed by a boolean expression. An example of a right hand side with several alternatives is given by the following definition of the greatest common divisor function, using Euclid's algorithm gcd a b = gcd (a-b) b, _i_f a>b = gcd a (b-a), _i_f a=q _w_h_e_r_e p = x^2 + 1 q = 3*x^3 - 5 Notice that the whole _w_h_e_r_e clause must be indented, to show that it is part of the rhs. Following a _w_h_e_r_e can be any number of definitions, and the syntax of such local definitions is exactly the same as that for top level definitions (including therefore, recursively, the possibility that they may contain nested _w_h_e_r_e's). It is not permitted to have locally defined types, however. New typenames can be introduced only at top level.