Programming Throwdown Episode 61 [PODCAST]
Sign up for weekly Clojure tips, software design, and a Clojure coding challenge.
In this podcast, we talked about Clojure and Functional Programming as well as the best ways to learn them.
**Patrick Wheeler**: [00:15] Programming Throwdown," episode 61, Clojure with special guest Eric Normand. Take it away, Jason.
**Jason Gauci**: [00:22] Hey, everyone. If you are a long-time listener, you may remember. We did an episode on Lisp almost three years ago. We are coming back, and we are covering in a lot of detail. One of the comments that we got when we did the Lisp episode from a lot of people was, "Hey, we want to learn more about Lisp." Here's some more details about Lisp and things like that.
[00:45] This is before we really had a strong social network presence where the only way you could really communicate was by emailing us. We got a lot of email about Lisp. We're really happy...Go ahead, Patrick.
**Patrick**: [00:59] We also briefly did mention Clojure on...We did a collective episode of a bunch of JVM languages.
**Jason**: [01:05] That's right. We mentioned Clojure by name there. We have Eric Normand to talk in much more detail about Clojure and teach all of us a lot of really cool things about Clojure. Eric, tell us about yourself and what do you do?
**Eric Normand**: [01:24] Hi. My name is Eric Normand. My current tagline is I help people thrive with functional programming. I run a site called PurelyFunction.tv where I teach people Clojure. I want to expand it to other functional programming languages. I basically teach with video and exercises and other online things.
**Jason**: [01:53] What inspired you to build that site and to teach people Clojure and other functional languages?
**Eric**: [02:00] It's evolved over time. I have always liked teaching. Well, always. I was a teacher in the Peace Corps. I was teaching math. When I got back, I started missing it. I started programming again. I started making videos off and on.
[02:24] At some point, I did a Kickstarter to get some Clojure videos made. That was a success. Ever since then, I've been adding more and more videos.
**Jason**: [02:37] What is it like, running a Kickstarter? I've funded several Kickstarters. I've never Kickstarted anything. What was that process like?
**Eric**: [02:49] It wasn't that big of a deal. I think the biggest thing was, beforehand, I talked to my friend who has funded a lot and saw what worked and what didn't. I hadn't been active on Kickstarter at all.
[03:07] It was a lot of discussions with him about, what should I set my goal at, what should my rewards be, that kind of thing. He helped me come up with the structure there.
[03:25] I'd say that my biggest advice for someone who's going to do a Kickstarter is, take into account the marketing that you're going to do during the campaign. I did mine for 30 days, which at that time was the default. I don't know what the default is now.
[03:43] At that time, it was default to 30 days. That's 30 days of you tweeting, and promoting, and being generally on edge about whether you're going to make it. If I were to do it again, I would probably cut it down to like 10 days or 15 days.
[04:03] Most of the backers came in at either the beginning or the end. If you just cut out the middle, then I would have had the same amount. More or less [inaudible] .
**Jason**: [04:15] One thing that I noticed is, the audience wants to have faith in you, in your delivering on the Kickstarter. If you're messaging every single day, like, "Here's what I ate for breakfast today. I ate Clojure-flavored Cheerios." [laughs]
[04:33] Then people know, OK, this person means business. If I donate, one, it's going to work out. Two, I'm donating to more than just a set of videos. It's like a cause.
**Eric**: [04:47] For sure. It really helps to have an audience before you start. I think that's the number one failure reason, is people don't have anybody who can list. They're shouting into the void.
**Jason**: [05:04] If you had to explain functional programming to someone who's never heard it before, how do you describe that? Let's say there's someone who has taken some courses. They get C++ really well, but they've never seen Lisp, or Haskell, or Clojure, any of these. How do you explain that to them?
**Eric**: [05:33] That's a really hard and complicated question because I don't think there is a very agreed upon definition of functional programming.
[05:46] Functional programming comes from Lambda Calculus. Lambda Calculus is a mathematics that uses nothing but functions. There's definitely the notion of using functions as your main form of abstraction.
[06:08] Functions are higher order. That means that they can be passed to other functions as arguments and you can return functions from arguments. Functions are values that you can pass around.
[06:25] Languages like C, C++ you can...Let's take C because I know that a bit better. You can pass function pointers around and stuff and people do interesting stuff with that, but they don't have what's called lexical clojures. It's a technical term. It just means a function that can refer to variables that are defined where the function is defined.
**Jason**: [07:21] That makes sense. One analogy is if you've ever played World of Warcraft or any of these MMOs or many games like it, in the beginning you get the wooden sword and you just hit the rat over and over again. As you get better and better, you get one of these swords that has what's called a proc which is short for procedure.
[07:47] It might be when you hit somebody, there's a 10 percent chance of them turning into a chicken or something.
[07:56] That process, that event is tied to that sword. Like you want to assign the turning into a chicken into that weapon and be able to if you give the weapon to someone else, you give that logic to them too.
[08:16] A part of functional programming is this idea that you can pass these functions around as sort of first-class citizens.
**Eric**: [08:24] Wow, that's a really great metaphor there.
**Jason**: [08:28] Yeah, I played too much World of Warcraft.
**Eric**: [08:32] Another way to look at it that I've heard about is if you're familiar with object-oriented programming, you've got objects that have methods. That's data with functions attached. In a lexical clojure like in a functional language, you have functions with data attached. The variables that are defined in the scope are the data that you can access from that function.
**Jason**: [09:12] That's functional programming. We covered Lisp in the Lisp episode. Basically, what is clojure? When we covered clojure we just very superficially said clojure is Lisp on the JVM, but I'm sure it's much more than just that. You're, "How does clojure fit into this whole landscape?"
**Eric**: [09:41] A good question. Clojure is a Lisp for the JVM. Lisp is cool because it's like a family, it's got dialects. Clojure is a dialect of Lisp that is made to be hosted on a virtual machine. JVM is like the first virtual machine that it's hosted on.
**Jason**: [10:08] Is there something that you can't do in closure because of that? Because it's a dialect of Lisp, is there some things that aren't there or are there that aren't in regular Lisp?
**Eric**: [10:22] That's a good question. It's a different language than Common Lisp. There's a lot of stuff that comes with Common Lisp that is built into the language. Whereas, in Clojure, because it's designed to be hosted, it just relies on what the host can do.
[10:44] I'll give an example. Common Lisp has this very sophisticated and a lot of features in the exception mechanism. When you throw an exception, you can actually do what's called a restart. You catch this exception and you can fix the problem, recall it and go right back to where the exception was thrown.
[11:09] If the fire's not found, you'd be, "Oh, not found. Well, let me make it." Then, you go right back in to where it was.
[11:19] Whereas, in Java, it's just built into the JVM, it's not part of the Java language. It's part of the virtual machine. The exception gets thrown. The call stack gets unwound and it's lost. You can't go back to where you were.
[11:36] Clojure borrows all of that stuff from the host that it's on. That includes Clojure's numbers are Java numbers. Clojure's strings are Java strings. Functions in Clojure get compiled into a Java class. All this stuff becomes some concept on the JVM.
**Jason**: [12:06] Got you. That makes sense. How are some of these things possible? In Java, you can't have Clojures, right? I'm assuming Clojure can't be built in Java. In other words, the concepts of Clojure have to be added in machine code to the JVM or something?
**Eric**: [12:36] Actually, it's really interesting how it's implemented. Most of the language is written in Java. Most of the data structures, most of the logic and the compiler, it's all in Java.
[12:55] The way Clojures are implemented is, like I said, there's a class. When you have a new function that you're compiling, it extends that class, that function class.
[13:15] The function class has a bunch of methods on it. Each method is a different signature. It will have the zero argument method. It will have the one argument method, the two argument method, etc. The class it compiles to will extend those.
[13:39] All of the data in the Clojure, meaning the variables and the scope that it needs to access, get put into the class as member variables.
**Jason**: [13:53] OK. That makes sense. Yeah, that's very clever. [laughs]
**Eric**: [13:57] It's clever. It's a way to use the function or the method called semantics of the JVM without having to invent some other mechanism.
**Jason**: [14:13] For somebody who's maybe really into web development or you've done a lot of C++, backend work, Java, why should they learn Clojure?
[14:30] For somebody who's already mastered one or two or several languages, we always talk about this metaphor of the toolbox and how there's not one magic language, just the same as there's not one magic wrench that just does everything, or not one magic tool that does everything. It's a wrench and a hammer and whatever.
[14:54] If someone wants to assemble this toolbox of languages that's comprehensive, what does Clojure add to that toolbox?
**Eric**: [15:07] That is a really great question. It's something that I don't think is really fully answered. I can tell you there's no general one answer to satisfy that question. I'll tell you why I like it and also why people I know like it, too.
[15:33] When it first came out, the big story behind Clojure was that it handled concurrency really well. The JVM or Java, the language, has a lot of libraries and stuff for handling concurrency. There are books written about how to do concurrency right on the JVM.
**Jason**: [15:57] Yeah, it's very hard.
**Eric**: [15:59] Yeah, it's hard. You have to read this book and do everything right or you're going to get bugs.
[16:07] What Rich Hickey, the creator of Clojure, did is he took that book and basically built the language around that. It works that way. It's very hard to not do it that way.
[16:25] A lot of the primitives in the language...there's all sorts of stuff in Java. You use the volatile key word. You make stuff immutable and things like that. All of that is taken care of for you.
[16:42] It has this really nice story of concurrency is the default. It works easily right out of the box. That is true. It's really nice. It's weird when I go to another language and I'm, "Well, how do I do this at the same time?" You can't. You have to do this other completely boiler plate system to get something else to run at the same time.
**Jason**: [17:12] That's a huge, huge problem. What typically happens is, especially if you're building an app for the desktop, you have some kind of UI and the person specifies some files. You want to go off and do a bunch of work on those files. It's almost always embarrassingly parallel.
[17:32] Very rarely do you need to do very sequential, one thing at a time. Usually, someone gives you a batch of things to do. In most languages like C++ and Java this can get quite painful.
**Eric**: [17:50] Yeah. It gets painful because all the pieces are there. Like, "Well, in Java, to make a thread, you just do new thread and you have a thread. What's the problem?" That's only half the answer.
[18:05] The other half is, now that you got this thread, how do you get information that it's calculating out back into the thread where you're going to display it on the UI. It's all these ancillary problems, like, "Oh, maybe I need a cue."
[18:20] OK, you're going to construct the thread, and the cue, and the thing. It just never ends.
**Jason**: [18:26] Yeah. Totally.
**Eric**: [18:28] Whereas in Clojure, it's as simple as, "Well, I'll just have..." There's a bunch of different primitives. One of them is called an atom. An atom is the simplest kind of shared state. It's just one pointer that you can change.
[18:48] You can have multiple threads accessing this pointer, you can read from it, or you can write to it. It's thread safe. One of the reasons I really like it is, the focus of Clojure is on the simplicity of separating out all the different problems and solving them independently, so that you can compose them back together.
[19:17] You have the atom. All it does is keeps one pointer and makes sure that whenever you transition from one state to the next, you're transitioning from a consistent state to another consistent state, like in a transaction.
[19:38] You can't see it halfway done. That is what allows multiple threads to read and write to it. Really, with very little code, you don't have to deal with locks and stuff like that. It's all handled by the atom.
[19:56] The simplicity of, "Here's the right tool for the job," and the language just gets out of your way, I really appreciate that.
**Jason**: [20:10] It makes sense. Most of the time, you don't need to do these hog-wild things, where you have three different threads all updating the UI at the same time. These things were important in the '90s.
[20:24] Now, it's like, if you have three threads and each one locks the UI updates and unlocks it, computers are fast enough where we don't need that level of control. If you are willing to sacrifice the level of control, you could have a much cleaner language.
**Eric**: [20:44] Yeah, for sure.
**Jason**: [20:47] There's people like Patrick, could do crazy robotic stuff, homebrew stuff. He's got a drone firing lasers that people come to his house.
[20:58] For the rest of us, the other 99 percent of us, we're either building a website, a desktop app, which could include a server that's serving web pages or a mobile app, like an iPhone app or an Android app. Can you do these three things, any or all of these things in Clojure? How does that work?
**Eric**: [21:22] Yes, for sure. The easiest one is the Web app. Web apps have been done in Java for a long time. There's a thing in Java called servlets, servlet interface. Most of the Clojure Web systems are some wrapper that uses the servlet API.
[21:58] Actually, the Clojure ecosystem, Web ecosystem is evolving right now. For a long time, the main system was called ring. It's like Rack in Ruby. All it would do is it would take the request and turn it into a map. It has a standard format mat. The request method was under a certain key. There was a string.
[22:30] The port was a different key and it was a number. You could get this map and then you did whatever you want with it. You would return a response with another map in a similar format. There's three concepts.
[22:56] There's the adapter, which is the thing that connects to the servlet API, or whatever API you're using to do the Web stuff. That adapter connects to the API and converts requests into the ring request, and converts the ring response back into an HTTP response.
[23:18] You have your handlers, which are functions from requests to response, and then what's called middleware, which transform the request or the response as it passes through. It actually transforms the handler into a new handler.
[23:42] You would basically construct your Web app out of these pieces. Like I said, it's evolving. People are learning stuff. They want to do asynchronous stuff. Functions aren't great for doing async calls. That's still the main ideas, is that you got this request map and a response map.
**Jason**: [24:07] If you're used to doing Java, server-side Web development, all of those ideas translate almost one-to-one to Clojure. Someone has written adapters. You can work in a completely Clojure environment to not have to worry about all of those bridges.
**Eric**: [24:28] That's right. To me, it feels much cleaner. How do I put this? It's much more direct. In the servlet API, you get this request object that you query like...You call the method like get method, which gives you the HTTP method.
[24:56] You really have to understand this API really well and look up the docs. When you do the response, you have to do set header. You're not supposed to call set header after you've typed in the body. There's all sorts of rules for how to use these things.
[25:23] To me, that it's really hard to keep track of. In ring, the adapter is supposed to handle that. You handle that one time. The adapter, once it's well written and conforms to the API and to the ring spec, it's done. It's like you can just close that book and say, "Well, version-whatever is done."
[25:50] That's the thing I really appreciate with the Clojure community. There's actually libraries that they're like, "It's done. We finished."
**Jason**: [25:59] [laughs] Nice.
**Eric**: [26:01] It's not this continuing thing, like, "Oh, we're trying to adapt it to this other situation, so you don't have this problem." We solved it." [laughs]
**Jason**: [26:13] What about mobile? If you're building iPhone app or Android app, can you do that in Clojure?
**Eric**: [26:20] There's a couple of options. I don't think that this is being done so much anymore, but because the Clojure runs on the JVM, it can run on the Android JVM, the Dalvik JVM. Most of the work now is in React Native.
**Jason**: [27:09] Does it use the V8, or SpiderMonkey, or both?
**Jason**: [27:17] That is super cool.
**Eric**: [27:22] You can run on node. You can serve it through a Web app, and whatever browser they've got, run it. You can do React Native. You can do electron. I mentioned PhoneGap. People have been doing that for a while.
**Jason**: [28:42] Yeah. It's two-way. You can actually...
**Eric**: [28:45] You can convert it back? [laughs] I didn't know that.
[30:35] That's OK because the source-mapping is all in there. When you look at it in your Chrome dev tools, you're looking at the ClojureScript code, and you're getting line numbers from your ClojureScript code through the whole stack trace.
**Eric**: [31:54] Bugs on line one."
**Jason**: [31:55] It's always on line one.
**Eric**: [31:57] [laughs] Exactly, exactly. The browser-makers came up with this system where you have this other file that's included along with it that gives you the ranges of code in that original file and then the line that they correspond to in the original file in the code that you wrote.
**Jason**: [32:58] Oh, man. That's awesome. I never actually knew you could do that. I always had unminified code when I was debugging. I'd never needed to do that. [laughs] That's cool.
**Eric**: [33:12] That's actually largely thanks to one system that the ClojureScript compiler uses. It's called the Google Closure Compiler. That's closure with an "s." Google Closure. The Closure Script Compiler is a very simple naive compiler, but it outputs code that the Google Closure Compiler can read.
[33:40] The Google Closure Compiler is what Gmail has built in, and it does some really aggressive optimizations. There's different modes. When you're going to release your code, it does all this crazy optimizations on it like totally analyzing code paths, eliminating functions you don't call, and things like that.
**Jason**: [34:05] Just to explain because it's super confusing. There's a Google Closure Compiler. I think it's...
**Eric**: [34:14] The naming is really terrible. [laughs]
[36:23] The idea behind splitting is that the compiler can analyze your code and figure out, "Well, the front page uses this bit of code. The back end uses this bit of code. Then this bit of code is shared between the two. You can cash that one that's shared between the two and only serve the home-page code and that shared code to the people who are visiting the front of your site.
[37:04] Then after they log in, they can get the rest of the code. It's a way to optimize the experience for people who don't need that part of the code.
**Jason**: [37:15] Cool. That makes sense. One thing that people might not realize, there's an incredible amount of energy spent on making especially the front page of any site load very quickly. There's statistics that show for every maybe 10 milliseconds, of course it depends on different products and different sites, that the front page takes to load, you lose x percent of your customers.
[37:44] It's pretty significant. If Clojure can separate that and speed that up, it's awesome.
**Jason**: [38:18] It's way too much work.
**Jason**: [39:21] Oh, no. [laughs]
[39:55] The number of tools you need and libraries and like, "Oh, you're still using Grunt? You should be using Yank, or whatever it's called.
**Jason**: [40:03] [laughs]
**Jason**: [40:23] It sounds like the ClojureScript is easier to work with than Emscripten. [laughs] If you've ever used that, it's a total nightmare.
**Eric**: [40:32] I don't even know what that is.
**Eric**: [40:53] Ah, for games.
[41:25] Talking to people who've worked at Zynga, it's just a total nightmare. [laughs] If you have a bug in the C++ part...
**Eric**: [41:33] [laughs] Oh, man. No bugs.
**Jason**: [41:34] you just have to catch it on mobile. If there is some bug where, if someone gets all four aces it crashes or something, you just won't catch it on the web. It's lost. [laughs] You just have to hope that you have that same bug on mobile.
**Eric**: [41:50] I'll tell you. I don't mean to bash on all these languages. I love languages. They're great, but I recently had to work in C++. I don't know C++, so it was totally new to me. I was already dealing with all of the novelty of everything, but the build system...
[42:14] It took me over a week to get it to build on my machine. I could imagine if then you finally got it to build, now it's running in the browser, and you don't have any Sourcemaps or something like that to debug it, oh, man.
**Jason**: [42:33] It's a total nightmare, but you're totally right. Now things are a little bit better. There's Bazel, and there's Buck. Bazel's from Google. Buck is from Facebook. They're basically the same thing, but even then, they're not great.
**Patrick**: [42:54] Even dependency management in C++ is still really bad.
**Jason**: [42:58] It's a total nightmare. There's really no repository that I know of. There's not really a central repository of C++. I don't even know how that would work because you wouldn't be able to keep the binary because it's machine-specific.
**Eric**: [43:14] I don't even know where to begin with that. I'm not in that world, and I'm glad I'm not.
**Jason**: [43:24] It sounds like ClojureScript is better than that, [laughs] is more mature than that.
**Jason**: [44:42] Absolutely. When I was in college, I got a Gentoo. For people who don't know, it takes about 18 hours to install, or at least at that time it took about 18 hours to install Gentoo. Now you don't have to be there for 18 hours, but it's like you get in. You install the boot loader. You spend about an hour entering all these different commands to install the boot loader.
[45:09] At the time, that was super cool because you feel like this Neo from "The Matrix," like some crazy hacker.
**Eric**: [45:16] Windows took a long time to install, too.
**Jason**: [45:19] In terms of effort, Windows definitely took a while to write to disk and all of that, but this was like you have your boot loader. You'd reboot to the command line to just a root prompt. Sometimes you'd do it wrong. You'd reboot, and nothing would happen. That was super, super fun at the time.
[45:44] As soon as you become a professional and someone says, "When is this going to be done?" and you say a week, then instead of taking 18 hours it takes 30 hours to install your OS, you're in big trouble. [laughs]
**Eric**: [45:57] For sure.
**Jason**: [45:58] It's not fun anymore. [laughs]
**Eric**: [46:01] For sure.
**Jason**: [46:02] You immediately switch to, "OK, I need something reliable that's quick that I could depend on.
**Eric**: [46:10] Sure. I remember in the '90s I used to run Linux, and it was the same as you were saying. It would take this huge amount of time to select your video card and make sure that x Windows would work with it and get all the settings right. There was no auto detect at that time. Then at some point I would just be like, "OK, enough. I need to check my email."
**Jason**: [46:40] [laughs] Right.
**Eric**: [46:42] I would just use the barest x there was. Barest x windows, the one where you boot into x windows, and you have to right-click to get a menu... [laughs]
**Jason**: [46:53] It's just like that weird...
**Eric**: [46:55] or you just get a terminal.
**Jason**: [46:56] That horrible grid of black and white dots, and your cursor is an x.
**Eric**: [47:01] Exactly. [laughs] Exactly, exactly. You'd just have a terminal. I would just type Netscape [laughs] in my web browser, so nice.
**Jason**: [47:55] Oh, nice.
[48:28] If you are doing a lot of interop where you're building up a Clojure vector of data, and then you need to pass it to something that's expecting an array, you're going to have to convert it. There's going to be a little performance penalty there every time you convert it.
**Jason**: [48:45] That makes sense. Most people use objects. There are cases where you need arrays, but that's more rare, I would think.
**Jason**: [49:18] That makes sense.
**Jason**: [49:29] That makes sense. Cool. We have a faction of the audience. I feel like faction's a connotatively positive word, but now I'm starting to doubt myself. [laughs]
**Patrick**: [49:49] A portion?
**Jason**: [49:50] We have a portion. We have a section of audience that's just really into the career side. It's people who want to get into the industry. Right now, they're really wondering, "What's the job market?" or, even if they're doing freelance, they want to do freelance work.
[50:13] They're wondering, "How would this affect my freelance work? If I'm given the freedom to use any language, does this boost my productivity? On the business end of it, how rich is Clojure right now?
[51:05] They're looking for people. I do have to say a couple of things. Because it's a smaller group, it is easier to get into, and it is, I believe...
**Jason**: [51:51] Yeah, I'm noticing.
**Jason**: [52:14] That makes sense. I think there's a lot to be said for joining a smaller community, especially when you're just learning. There's a lot of resources, there are people who are very passionate about it. You're not just completely swamped.
**Jason**: [53:11] [laughs]
**Jason**: [53:36] Things are starting to trend in the direction of more fully-featured languages. If you look at Haskell and Scala, for example, they have type inferencing. The browsers now are more sophisticated, so you can see the inferred type. The combination of the browser and the tooling getting more sophisticated, and also the projects just becoming more complex. It dictates languages that are more principle.
**Eric**: [54:36] I just did a workshop, and we did ClojureScript. A lot of them were first-time programmers, and it went well. I think we had to install two programs on their computer. We had to get the JVM on there because the ClojureScript compiler does run on the JVM. It's written in Clojure. Then we had to get Leiningen, which is the Clojure project-management tool.
[55:10] With those two things, you're done. This is really crazy. There's an editor called Nightlight that is just a plugin for Leiningen. You just type "Lein Nightlight," and you get an editor that you open your browser to a certain URL. You've got an editor editing the code in that project.
**Jason**: [55:43] Oh, nice.
**Eric**: [55:45] You've got live reloading with another plugin. You're typing, and you can see the change in your browser. You can see the effect of that. It's just an amazing experience that someone can type a couple commands at the terminal and get this development experience going.
**Eric**: [57:04] Yeah, exactly. I've been waiting for a little bit, like a couple of years now. We've heard that React is functional. When you have a functional language and a functional framework, it just works so well together.
[57:26] The React wrappers in ClojureScript, there's actually several that are popular. The React wrappers make it so nice. A component is just a single function. You can do all the life cycle stuff if you want, but mostly, you don't need it.
[57:47] You keep your state in an atom, it's just so clear how your UI is changing based on the state, and adding stuff to the state, removing stuff from the state, changing the UI. Anyway, it is such a nice development experience that I've been expecting someone to sweep a hackathon.
[58:18] Do something amazing in 48 hours that no one else would believe was even possible, because they were using ClojureScript. I've been waiting for it to happen, but I haven't seen it yet.
**Jason**: [58:32] Only a matter of time.
**Eric**: [58:34] Yeah. Maybe. I don't think I've done it enough justice. Not only is the development experience great, where you have live reloading. When I say live reloading, it doesn't mean it just refreshes the browser automatically.
[58:56] What it means is your app state is still there, but the UI...you've changed your UI code. You could be a few clicks in. You're testing out your...
**Jason**: [59:13] You have an email app and the email's half written.
**Eric**: [59:17] Right. Then you're like, "That component doesn't really look right." Or, "Let me add bold to this toolbar," whatever. You just add the code and bold to the toolbar, and boom, the component just changes, and the email text is still in there.
**Jason**: [59:40] That's awesome. When we explained functional languages, three years ago now, we told people...A lot of people say, "I've never done functional programming." We've told people, "Actually, yes, you have. And probably your parents have too. It's called Excel."
**Jason**: [59:57] When you're using Excel and you type a formula, and then you pace some data, and just magically, as you're changing the formula, the spreadsheet's just changing, it feels so alive and magical. It sounds like with ClojureScript, you get that same feeling, but with Web development.
**Eric**: [60:18] For sure. You go back to where you have to reload, and then you click through a few things to open the thing back up that you were looking at, to make sure that you did it right. "I didn't do it right," or, "I want to change the styling a little bit more."
[60:35] You have to change the code and then reload. I have no patience for that anymore. I've been spoiled.
**Jason**: [60:43] It makes sense. [laughs] If someone wants to learn Clojure, what's the best way that they can get started?
**Eric**: [60:53] Good question. There's a lot of book, but I'm actually going to take this as a cue to plug my stuff. I've got PurelyFunctional.tv. There's, wow, 150-something videos on there...
**Jason**: [61:15] Wow.
**Eric**: [61:16] of varying length. Most of them are behind a paywall. There are some things that are available for free if you want to just test them out and see if you like it.
[61:32] There's one called "Intro to Clojure," that's not Clojure Script, it's regular Clojure. It's the same syntax, same data structures, same core library. It will help you on your way. Also, I've got a page set up, purelyfunctional.tv/throwdown, and I'll give you a nice coupon code for a discount on a subscription.
**Jason**: [62:03] Very cool. Just to recap, if you could, what was the first part?
**Eric**: [62:08] Purelyfunctional.tv
**Jason**: [62:10] Purelyfunctional.tv/throwdown. I'm assuming all one word, no hyphens or anything?
**Eric**: [62:17] Right.
**Jason**: [62:18] Purelyfunctional.tv/throwdown. If you go to that URL, you actually get a discount for some of the premium content on the site.
**Eric**: [62:29] Yeah. Get in touch with me. My email is eric@Lispcast.com. I love answering email about Clojure. Any questions you have, that'll be great too.
**Jason**: [62:42] Awesome. I'm definitely going to check this out, this is super cool. I had no idea actually that Clojure could be used with React and React Native. I've struggled trying to learn React and React Native. I did learn them eventually, but it was not intuitive.
[63:25] There are other things, Scala is a good example, where I write some Scala, and I just want to write less Scala.
**Jason**: [63:35] I had to do it for a job, so I powered through it. I feel React Native is one of these things, where the more I did it, the less I wanted to do it. I'm going to try with Clojure, with ClojureScript, and see if it feels more natural.
[64:21] There was all the styling and the new components that you had to learn. The biggest thing of all, which I don't think we ever solved, I think no one has solved this yet, the routing. I don't do much mobile development, and apparently routing is really important, and I just don't get it.
**Jason**: [64:44] Yeah, same here.
**Eric**: [64:47] It has to do with keeping track of the back button, and stuff can slide in from the right and slide in from the bottom. When you hit the back button, you want to remember the right thing to go to. Anyway, apparently that's a hard problem.
[65:11] I got my bearings in the React Native, and that was cool. I tried it with ClojureScript and it was just so fun. Now, I didn't make a complicated app with a lot of screens and stuff, but it actually felt like, wow, I can now make all those little apps that I thought should be easy to do.
[65:33] I wanted to make a...
**Jason**: [65:35] Like a tip calculator or something?
**Eric**: [65:37] Yeah, exactly. I run, so I want to track my runs. I use Runkeeper but it's overly complicated for what I need. I just want something like, I click a button and I start running. I did it, and it's so nice. I'm actually making a course about that app that I made.
[66:06] I've given a talk about it. It's a really simple app you can make, and it shows off how nice that live reloading is. You're tweaking the UI and it just magically changes in your little iOS simulator.
**Jason**: [66:25] Very cool. I think that wraps it up. Merry Christmas. Happy Kwanzaa. Happy Hanukkah. Other things I might have missed, because this episode will probably go around that time. Happy holidays and all that.
[66:46] Thank you, everyone out there, for supporting the show. Thank you, Eric, for coming on the show and explaining Clojure to us. We really appreciate your time. Do you want to give a shout-out to the link one more time, so people could get that discount?
**Eric**: [67:04] Yeah, purelyfunctional.tv/throwdown.
**Jason**: [67:11] There it is. Have fun. Happy hacking. Hopefully, you have a cool Christmas project. Patrick's probably going to build, as I said, some robot that will terrorize his neighborhood.
**Patrick**: [67:26] I feel like you're just going to make the feds show up at my door.
**Jason**: [67:28] [laughs] I don't really have anything in mind. Actually, I do plan on doing a lot of drawing. I wrote a script for a game. This is like role-playing. Like one of these RPG games where it's a lot about dialogue and characters. Now I want to actually go and draw all those characters.
[67:54] I think I'll probably make that my Christmas project.
**Eric**: [67:58] That sounds really cool. Get away from the computer.
**Jason**: [68:01] Have fun. Have a happy Christmas. We'll see all your listeners next year.
[68:07] Intro music is aXXo by Binarpilot.
"[68:10] Programming Throwdown" is distributed under a Creative Commons attribution ShareAlike 2.0license. You're free to share, copy, distribute, transmit the work, to remix, adapt the work, but you must provide attribution to Patrick and I, and ShareAlike in kind.