[Ur] Mutually recursive values

Adam Chlipala adamc at csail.mit.edu
Thu Jul 9 11:00:57 EDT 2015


Actually, the problem is just that the second [val rec] should be left 
out.  This syntactic convention follows Standard ML.

On 07/09/2015 10:51 AM, Gabriel Riba wrote:
> Trying to use mutually recursive values don't compile, giving the error:
>
> syntax error: replacing  AND with  UNDER
> Parse failure
> ----------
>
> Here is a sample to try with:
>
>   val rec even (i:int) = if i = 0 then True
>                        else if i > 0 then odd (i -1)
>                        else error <xml>error: negative input</xml>
>
>   and val rec odd (i:int) = if i = 0 then False
>                           else if i > 0 then even (i -1)
>                           else error <xml>error: negative input</xml>
>
> (* --- *)
>
> I have found the syntax problem in urweb.grm....



More information about the Ur mailing list