recursion - Standard ML: Iterative vs. Recursive -


i'm reading through ml working programmer , bit confused author's distinction between iterative , recursive. understanding "recursive" refers function calls itself. function isn't recursive iterative (where iterative algorithm involves kind of looping).

however, in book, author "luckily obvious recursive solution iterative." understanding of these terms different how author using them.

can clarify i'm misunderstanding these terms?

thanks, bclayman

iterative means can express loop. however, speaking, loop special case of recursion. example, in sml, loop

while b 

is literally defined syntactic abbreviation recursive definition

let fun loop() = if (b; loop()) else () in loop() end 

that's why "iterative" not understood opposite of "recursive", special case: recursive definitions iterative, others not. more specifically, special case of linear recursion, recursive definition invoked @ once.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -