On Nov 22, 2023, at 4:40 PM, Todd Wilson <twilson@csufresno.edu> wrote:
Hello, Cafe:_______________________________________________Is there a preferred way to define two top-level mutually recursive functions, f and g, that both use a common local function h such that h is (1) only defined once and (2) does not escape the scope of f and g? I suppose it could be done like this:fg = let f ... = ... f,g,h ...but is there something more elegant than this that I'm not seeing?
g ... = ... f,g,h ...
h ... = ... h ...
in (f,g)
f = fst fg
g = snd fg
Todd Wilson
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.