News for hackers. Stuff that matters.
Re:Programming at the REPL (2018) by reddit_clone on Friday July 10, 2020 @12:29PM (#23793207)
Yep. Thats what I do too.

For emacs users, 'eval-region' and 'eval-expression' are your friends.

Re:Programming at the REPL (2018) by Jtsummers on Friday July 10, 2020 @01:10PM (#23793720)
And if you have language support in org, use an org file.

  #+BEGIN_SRC lisp
    (+ 1 2)
  #+END_SRC

  #+RESULTS:
  : 3
(type C-c C-c inside the source block)

If you use noweb it'll also include referenced blocks in the evaluated unit:

  #+NAME: foo
  #+BEGIN_SRC lisp
    (defun foo (n) (+ 1 n))
  #+END_SRC

  #+BEGIN_SRC lisp :noweb yes
    <<foo>>
    (foo 2)
  #+END_SRC

  #+RESULTS:
  : 3
This lets you have many versions of code in one file (if that's a sensible thing for you, very useful when exploring a new library or concept though), and in the end you can aggregate it all into one source file for sharing with others:

  #+BEGIN_SRC lisp :tangle foo.lisp
    <<foo>>
    <<bar>>
  #+END_SRC
(type C-c C-v C-t to create the file)

I've mainly used this (for interactive development) with Common Lisp, but it should work for most other languages that offer similar interactivity.

Re:Programming at the REPL (2018) by jetti on Friday July 10, 2020 @12:43PM (#23793377)
If you are doing Clojure development in emacs CIDER makes things super easy. Loading files or buffers into a repl as well as eval region and sexp (there are a ton more features but those are the main ones I use)

Edit: I should have included a link for CIDER: https://cider.mx/