Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:57:55+00:00 2026-06-10T09:57:55+00:00

Maybe I’m missing something, but I find experimenting with code in the REPL better

  • 0

Maybe I’m missing something, but I find experimenting with code in the REPL better excersise for my fingers than for my brain.

Let’s say you’ve defined a simple class (excuse the crappy example):

scala> class Farmer(){var name = ""
     | def apply (name: String) = {this. name = name}
     | override def toString():String={name}
     | }
defined class Farmer

scala>

Is there a way to get that whole definition and make a change to it, without retyping or ‘up-arrowing’ line by line. For example, say I just wanted to add one function definition:

scala> class Farmer(){var name = ""
     | def apply (name: String) = {this.name = name}
     | override def toString():String={name}
     | def +(surname: String) = {name = name + " " + surname}
     | }
defined class Farmer

scala>

In other words, is there a way to tell REPL to replay the full multi-line entry from the previous input (up to a certain line), rather than just one line at a time (as happens when pressing the up arrow)?

In ‘Happy land’ it would have been nice to do something like, pressing ALT and then typing toString and then hitting return, and then the REPL will retype:

scala> class Farmer(){var name = ""
     | def apply (name: String) = {this.name = name}
     | override def toString

So basically the REPL retypes your code for you, up to the point you specified.

If anyone have any ideas on how to make using the REPL a bit more efficient than what I’m doing, I’d love to hear from them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:57:56+00:00Added an answer on June 10, 2026 at 9:57 am

    How about copy&paste? Scala will detect that you are pasting from a repl session, and act accordingly (that is, ignore “scala>” and “|”). Though it’s more readable if you use :paste mode to do stuff.

    Otherwise, you might be happier with another repl. I find that ScalaConsole is pretty good for this kind of stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe I'm missing something obvious, or maybe something sinister is happening, but this seems
Maybe this is something I am just missing, but is there any way to
Maybe I am missing something, but they seem similar. If you use for example...
Maybe I'm missing something but why does visual studio break execution to tell me
Maybe I am missing something entirely simple here, but in any new windows form
Maybe I missed something really obvious but this code doesn't work: <pre> <?php print_r(($progress));
Maybe this is a poor question, but, I can't find a tutorial or even
Maybe that's only possible with SQLITE but is there also a trick to let
Maybe this is a simple question, but I didn't find answer in web. I
Maybe there is a similar question to this, but I couldn't find a one.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.