recursion - Abstracting a loop -


I sometimes feel like writing a loop within my work (recursive work) it creates weird codes like this Is:

  value = REC loop one = if ... then another loop AB loop a   

I know I go can move the loop out of the binding, but it is the only objective to calculate tied value.

So I thought I could summarize the loop in a different function:

  let's go f = a rq a = a = match with f a. Some B - & gt; Aux B None - & gt; One aux a   

I could then:

  value = one |> Maybe it's better - at least this function is more than definition As an assignment I & lt; These are my questions:  
  1. Is there a recursive function in Is there any compulsion for any code odor?
  2. Is there a better way of refactor
  3. If not, can my loop function be normalized, or improved in some way?

    1. No
    2. I think what you are doing, I got it Is okay
    3. Here's how I do it:

        REC loop guard step init = if guard init then init else loop guard step step init) Assume = a | & Gt; Loop (funny - & gt; ...) (funny - - gt; a.b)      

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -