News for hackers. Stuff that matters.
Re:REPL Driven Design by ch4s3 on Thursday May 28, 2020 @12:28PM (#23339201)
His argument feels like a straw man. You can and should fill in a few tests after you confirm something in the REPL. Maybe Clojure folks don't do that, but Ruby and Elixir devs often do. I would imagine he's familiar with that approach.
Re:REPL Driven Design by lvh on Thursday May 28, 2020 @01:55PM (#23340282)
The REPL in Clojure (and other Lisps) is far more tightly integrated with your editor environment. When I wrote python, I would do what you're describing: test something in (i)python, write some code, rinse, repeat. With Clojure, I Write said experiments in the same place my code already is (and will end up). Making that feedback loop 10x tighter makes a world of difference in UX: I don't think it helps insight to equate "typing things in irb" with "mashing C-x C-e until the expr does what you want".

(I have no idea if an equivalent workflow exists in Elxir, but I've never seen it been done that way: just like people use ipython, they use iex in my experience.)

Re:REPL Driven Design by regulation_d on Friday May 29, 2020 @01:19PM (#23352741)
A pretty common pattern I've seen in both Ruby and Elixir is to begin building up the state you want to work with in a test and then drop into a repl using pry (either adding a breakpoint in the code or in the test). I think this allows you to "Write said experiments in the same place [your] code already is".

Maybe I'm just misunderstanding what people in Clojure are doing. Please feel to point me in the right direction.

Re:REPL Driven Design by mping on Thursday May 28, 2020 @12:47PM (#23339454)
Clojure folks do that. Don't know about all of them, but lots of them do. You even have emacs cider shortcuts to run tests from a live repl.
Re:REPL Driven Design by emidln on Thursday May 28, 2020 @03:19PM (#23341251)
I literally wrote code in .clj files and then my editor can slurp that up and barf it into a repl. There was never a point where I was writing something that "only existed in the repl" such that I couldn't just put it in a unit test if it needed formalized.

The usual workflow was something like

    (comment
    
       ;; experiments go here
       (defn add [a b]
         (+ a b))

       (= 2 (add 1 1))
       (= 3 (add 1 2))
       (= 99 (add 9 90))

    )
Once you have what you want, you move the code out of the comment block. Whether you move it into a library or a test file is just dependent on the type of thing you're moving. Functions moved into library code. The samples that proved the happy paths (or unhappy paths) would go into test files using `clojure.test/is` (and typically a direct copy/paste).
Re:REPL Driven Design by capableweb on Thursday May 28, 2020 @01:02PM (#23339645)
I concur. Use REPL driven development to arrive at a solution, but use unit tests (or similar) to make sure there are no regressions in the future and that it continues actually being a solution.
Re:REPL Driven Design by ch4s3 on Thursday May 28, 2020 @01:51PM (#23340233)
That's really cool. I need to revisit clojure in the near future.