in reply to Different behaviors between "while" and "map"

You shouldn't use map or grep for this purpose. map transforms one list into another, applying a given function to each element in turn. grep filters a list by applying a given function which returns a boolean value to each element in turn.

You're relying on side-effects of their implementation, and that'll cause you grief.

  • Comment on Re: Different behaviors between "while" and "map"