[eeps] Multi-Parameter Typechecking BIFs

mats cronqvist <>
Wed Feb 25 12:02:53 CET 2009


James Hague <> writes:

> A very interesting discussion indeed!

  although I feel bad about hijacking the thread...

[...]


>
> Current:
>
>     cross({V10,V11,V12}, {V20,V21,V22}) when is_float(V10),
> is_float(V11), is_float(V12),
>            is_float(V20), is_float(V21), is_float(V22) ->
>         {V11*V22-V12*V21,V12*V20-V10*V22,V10*V21-V11*V20}.
>
> Multiple parameters;
>
>     cross({V10,V11,V12}, {V20,V21,V22}) when
> is_float(V10,V11,V12,V20,V21,V22) ->
>         {V11*V22-V12*V21,V12*V20-V10*V22,V10*V21-V11*V20}.
>
> Inline types:
>
>     cross({V10::float,V11::float,V12::float},
> {V20::float,V21::float,V22::float}) ->
>        {V11*V22-V12*V21,V12*V20-V10*V22,V10*V21-V11*V20}.


  Using the -type attribute:

 -type(float_point():: {float(),float(),float()}).

 cross({V10,V11,V12}::float_point, {V20,V21,V22}::float_point) ->
     {V11*V22-V12*V21,V12*V20-V10*V22,V10*V21-V11*V20}.



More information about the eeps mailing list