Provide iex snippets that can be copied and pasted into iex

I’m writing some library documentation and I would like for the reader to be able copy from a code snippet and paste into his iex repl.

For example I might have:

iex [10:46 :: 10] > PE.execute(pid)
:ok
10:47:11.502 [info] New task instance [service_task][f742109b-8fea-465c-b2f0-63fa07d56f92]
10:47:11.502 [info] Complete service task [service_task[f742109b-8fea-465c-b2f0-63fa07d56f92]
10:47:11.503 [info] Process complete [process_with_single_service_task][b5fa354c-9e38-426b-883c-4cacc45e502e]

I wold like for the reader to be able to copy just the function call (PE.execute(pid)) and paste that into his repl and get the same results as shown.

I only ask this because it seems like I’ve seen this work before somewhere. Is it possible?

The repl most likely will complain that pid/0 is an undefined function and even if your snippet includes a bound pid variable, execution times would most likely be different. That is assuming the creation of the hex strings donot involve anything pid or time related stuff.

Or maybe I’m missing something?

Thanks for responding but I am sorry for wasting your time. I think I was going down the wrong path with that post. It didn’t make a lot of sense.