Search code examples
haskellmonadsstate-monad

Why the author claims this function call not to be a recursive call?


The author claims that the next call is not a recursive call, but I don't get why.

Taken from a Caltech course slides

Source: http://courses.cms.caltech.edu/cs11/material/haskell/lectures/haskell_lecture_5.pdf


Solution

  • The code is recursive (it is defined in terms of itself). I believe that @leftroundabout's idea about the emphasis being on function is accurate. The next slide says that

    do putY (y - x)
       gcdST
    

    is

    Recursive data definition
    * not recursive function call
    * like ones = 1 : ones
    

    I.e. there is no recursive function call because gdcST is not a function (it takes no argument!). This is a recursive data definition.