You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
Curv only supports recursive function definitions, not recursive data definitions. The 'illegal recursive reference' error is reported early in compilation: it happens while resolving names, before all identifiers have been looked up.
A definition like this causes an error, because it looks like a recursive data definition to the compiler:
If the compiler somehow knew that f is a function that returns another function during this phase of compilation, then it could treat this as a recursive function definition and generate the appropriate code. But it is not smart enough to do that. And match is just an ordinary function, it is not a keyword or special syntax, so the same problem happens if you replace f with match.
Until this is fixed, the workaround is to write:
rand1 x = x >> match [
(x) -> frac(sin(x)*100000.0);
(x,y) -> rand1(rand1(x) + rand1(y));
];
It seems that curv currently does not allow recursive function definition (see group thread). The following code
raises the following error:
The text was updated successfully, but these errors were encountered: