<P> A function can perform input or output and still be pure if the sequence of operations on the relevant Input / Output devices is modeled explicitly as both an argument and a result, and I / O operations are taken to fail when the input sequence does not describe the operations actually taken since the program began execution . </P> <P> The second point ensures that the only sequence usable as an argument must change with each I / O action; the first allows different calls to an I / O - performing function to return different results on account of the sequence arguments having changed . </P> <P> The I / O monad is a programming idiom typically used to perform input / output in pure functional languages . </P> <P> The definitions above still allow some laxity with regard to purity . It is possible for a pure expression to yield an impure function (or more generally a value which contains one or more impure functions). </P>

What is pure and impure function in java