Fixes #1829. Preserve variable scope in the REPL
Merge pull request #2814 from epidemian/issue1829

Fixes #1829. Preserve variable scope in the REPL
Add REPL scoping tests
Merge remote-tracking branch 'epidemian/issue1829'
@epidemian typo