Each week, we discuss a different topic about Clojure and functional programming.
If you have a question or topic you'd like us to discuss, tweet @clojuredesign, send an email to [email protected], or join the #clojuredesign-podcast
channel on the Clojurians Slack.
This week, the topic is: "using the REPL to explore". We find ourselves in a murky situation, so we go to our REPL-connected editor to shine some light on the details.
"We often want to see highlights more than we want to see the game."
"Like so many things with interns, there is really low supervision, so no one's really worried about how we get it done."
"Having something done is better than not, so the bar is 0."
"It sounds like a natural integration with an asynchronous message queue called 'Outlook'."
"I like to call it 'streaming specification'. I'm not going to tell you everything. I'm coming up with this off the top my head."
"We call them situated problems. They're problems that are set in the real world, so you need to know about all the things in the real world. It's a learning problem."
"You say, 'the things we can't control.' I think of it as, 'the things that are foisted upon us!'"
"We're going to find a way to use Clojure to solve this problem. I bet you didn't see that coming!"
"The first thing I usually do is go for the completely correct and entirely comprehensive documentation that describes all of the different use cases that I might need, and in fact, has a sample code." (Ha! If only!)
"It can be said that programming is debugging an empty file." "The first bug is my application does nothing!"
"You want to get to your first rewrite as fast as possible, so write the messy version first. Then you can learn what you want the next version to be—even if the next version is also messy. The sooner you learn the better."
"I'm starting to build up little pieces to help me explore."
"We're going to figure it out interactively, using the REPL. We're getting our bearings."
"Get in the code right away—hitting an external service as soon as possible—so we can begin to learn, so that we're solving the right problem instead of some problem of our imagination."
"Once it's Clojure data structures, the whole world of Clojure opens up. All the power of mixing and matching and analyzing that data is open to you."
"We're getting into the real thing. We're getting real data, real code. This is going to begin to grow up into something, but for now, we just want to see what's there—begin to explore—get some working code so that we can."
"It's hard to imagine the workflow, because it's not a workflow that you do in other languages. If you haven't done this before, it's hard to just imagine it."
"It's not just REPL first, but REPL-connected editor first, and there's a distinction."
If you are unfamilar with the Clojure command line, check out the Deps and CLI Guide. You can set up global aliases in $HOME/.clojure/deps.edn
. For example, this is one Christoph uses:
{:aliases
{:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "RELEASE"}
cider/piggieback {:mvn/version "RELEASE"}}
:jvm-opts ["-server" "-XX:MaxMetaspaceSize=256m" "-Xmx1280m"]
:main-opts ["-m" "nrepl.cmdline"]}}}
Run it with:
clojure -M:nrepl
You can see more examples in Nate's dotfiles and in Sean Corfield's dot-clojure project.
#_
to ignore the next form