  --[[
                     A way  to do mutual recursion.
                     ========================
  Calculate how many steps it takes to reach 1 from a given
  number, using the rules:
  If the number is odd, multiply by 3 and add one, otherwise halve it.
  The Collatz conjecture asserts that this process always terminates at 1.
  --]]
  
  local n = 0 -- count steps
  local mutual = {
  
      [0] = \ (self, x) print (x); n += 1; => self:collatz (x//2) end ,
  
      [1] = \ (self, x) print (x);  n += 1; => self:collatz (3*x + 1) end ,
  
      collatz = \ (self, x)
                          if x < 2 then => n end -- if
                          =>  self[x%2] (self, x)  end ,
           }
  print "Enter a positive whole number"
  repeat
      x = io.read  "*n"
      if x < 1 then print "Try again" end
  until x > 0
  print "-----------"
  local m = mutual:collatz (x)
  print "-----------"
  print (m, " steps taken")