This package does what ESS does for R for various REPLs, including ielm.
Emacs Speaks Statistics (ESS) package has a nice function called ess-eval-region-or-line-and-step, which is assigned to C-RET. This function sends a line or a selected region to the corresponding shell (R, Julia, Stata, etc) visibly. It also start up a shell if there is none.
This package implements similar work flow for various read-eval-print-loops (REPLs)