szlo has quit [Read error: 104 (Connection reset by peer)]
szlo has joined #ocaml
fab_ has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
wimp has joined #ocaml
goltrpoat has joined #ocaml
<goltrpoat>
quick question.. i have four functions where the last one ends up calling the first one (so it's basically a recursive function split into four smaller ones). defining them as normal results in at least one undefined symbol
<goltrpoat>
defining all four with the 'and' syntax gives error: FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'factor' will evaluate 'expr' will evaluate 'term' will evaluate 'expterm' will evaluate 'factor'
<goltrpoat>
there's no reason to make the functions lazy makes no sense
<goltrpoat>
any suggestions?
<goltrpoat>
er. -"makes no sense"
<goltrpoat>
or whatever would turn that into a real sentence.
<goltrpoat>
there are no forward declarations in ocaml, right
<Smerdyakov>
Mutually recursive definitions subsume some of the functionality.
palomer has joined #ocaml
palomer has left #ocaml []
<goltrpoat>
smerdyakov: hmm?
<Smerdyakov>
Look for the 'and' keyword in the language grammar.
<goltrpoat>
[21:59] <goltrpoat> defining all four with the 'and' syntax gives .. etc
<goltrpoat>
(this is F#, not ocaml, but it's supposed to be core compatible)
chessguy has joined #ocaml
<Smerdyakov>
I guess I should read backlogs more often.
<Smerdyakov>
Right.. 'and' only works with function definitions and type definitions in standard OCaml.
<Smerdyakov>
My guess is that you may be thinking Haskell-like and not making something a function by adding an extra 'unit' argument.
<goltrpoat>
i guess the question is.. should this compile? let rec f = g and g = h and h = i and i = f
<Smerdyakov>
No.
<Smerdyakov>
Ah, I see.
<Smerdyakov>
Not only must you be defining functions, but each definition must begin with 'fun' or 'function.'
<Smerdyakov>
Or use the special 'let' syntax for functions where you list arguments before the '='.
<goltrpoat>
well.. there are no arguments in the definition, they're supposed to curry
<dylan>
wow, someone wrote a song about the mandelbrot set.
<Smerdyakov>
Then you can't use it in a recursive definition.
<goltrpoat>
lemme paste the whole thing somewhere, sec
<Smerdyakov>
goltrpoat, you probably see that general recursive definitions have no easy compilation model, right?