Expand subset of lreplace functionality that is compiled.