Functional Design in Clojure

Functional Design in Clojure

By Christoph Neumann and Nate JonesTechnology
Download on the App Store

Functional Design in Clojure episodes

  • Ep 059: Lining It Up

    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: "Sequences." We examine the sequence abstraction and then ponder how it helps and hinders our data transformation.

    Selected quotes:

    • "There is only one filter, map, and reduce. They need to be able to interpret all collections."
    • "Primitives only take you so far."
    • "The first thing is the first thing!"
    • "The seq abstraction is foundational to Clojure core."
    • "The into function pours a sequence back into a concrete data structure."
    • 33 min
    • Ep 058: Reducing It Down

      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: "Reduce and reducing functions" We take a long hard look at reduce and find the first of many generally useful nuggets inside.

      Selected quotes:

      • "Parentheses are a joy, they are hugs around your code."
      • "You want to boil it down into a result, so you use reduce."
      • "We've taken ahold of the cooking metaphors and are just running with it!"
      • "Reducing functions are a backbone of functional programming, because we don't have mutation."
      • "Understanding reduce is really important for understanding functional programming."
      • Related episodes:

        • 002: Tic-Tac-Toe, State in a Row
        • 29 min
        • Ep 057: Clojure/Conj 2019 Recap

          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: "Clojure/Conj 2019 Recap" We go through our notes and recall the most memorable talks from the Conj last week.

          Selected quotes:

          • "Cold climate, warm people."
          • "Learn skills that transfer."
          • "The future is about immutability and composability."
          • "YAML! YAML! YAML! The names of an episode we have not done, and probably will not do."
          • "If you can make solving problems easier by using Clojure, then there is a lot of incentive to learn and use Clojure."
          • "You can't get rid of bias, even when you know you have it. All you can do is change how you work."
          • "The Conj has become less about Clojure and more about solving problems."
          • Talks:

            • Defeating the Four Horsemen of the Coding Apocalypse - Mark Bastian
            • Follow the Data: Product Development in Clojure - Derek Troy-West
            • Application: Operatr
            • Love Letter To Clojure: And A Datomic Experience Report - Gene Kim
            • New book: The Unicorn Project
            • Goodbye YAML: Infrastructure as Code in Clojure - Eno Compton & Tyler van Hensbergen
            • Interactive Programming for Artificial Intelligence - Dragan Djuric
            • Libraries: uncomplicate.org, Blog: dragan.rocks, Books: aiprobook.com
            • Probabilistic Record Linkage of Hospital Patients - Chris Oakman
            • Rapid Prototyping for Software Development - Sara Kimmich
            • (Architecture) Diagrams as Data - Avi Flax
            • The Hitchhikers Guide to Multiparadigm Programming - Ariel Ortiz
            • A Racket Perspective on Research, Education, and Production - Matthew Flatt
            • Site: racket-lang.org
            • Composable Tools - Alex Miller
            • Sherlock Holmes, Consulting Developer - Stuart Halloway
            • 35 min
            • Ep 056: Opt-in Complexity

              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: "Opt-In Complexity" We discuss complexity and try to come up with a simple explanation for why Clojurians avoid it so ruthlessly.

              Selected quotes:

              • "Abstraction: the thing that creates more complexity while making you feel like you have less."
              • "Clojure people seem to be allergic to complexity."
              • "Frameworks are the breeding ground for complexity."
              • "Complexity is the enemy of long lived code bases."
                • "Each part of the application is in its own vault of isolation, and they only get to come together and interact in the lobby."
                • "You can't be afraid of something that hasn't scared you yet."
                • "It's very difficult to say no once you've said yes."
                • Links:

                  • Simple Made Easy
                  • Luminus
                  • Hoplon
                  • Pedestal
                  • 29 min
                  • Ep 055: Sets! What Are They Good For?

                    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: "Sets! What are they good for?" We examine one of the lesser used data structures in Clojure and talk about its unique characteristics and uses.

                    Selected quotes:

                    • "Sets aren't going to get top billing."
                    • "Sets are really about uniqueness."
                    • "Sets let us calculate differences cheaply."
                    • "Clever is a word I used to like when I was a younger programmer."
                    • "Clever now equals hours of suffering!"
                    • 29 min
                    • Ep 054: The Forest in the Trees

                      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: "Working with heavily nested trees." We discuss three powerful libraries (Specter, Spectacles, and clojure.walk) and where they might fit into our Clojure programs.

                      Selected quotes:

                      • "Tree manipulation is like surgery, you need to get down to the right level before you start making changes."
                      • "I've seen people come up with novel and interesting solutions to problems that other people just don't have."
                      • "Spec is a structural type checker, instead of a name-based type checker, which is far more useful."
                      • "Every time you reach for a tool, you're inviting its complexity into your project."
                      • "The structure of your data will lead you toward a particular tool."
                      • Related episodes:

                        • 020: Data Dessert - Summary episode for the time log series
                        • Links:

                          • clojure.walk
                          • Specter
                          • Spectacles
                          • 22 min
                          • Ep 053: How Can I Save My Data From Serialization?

                            Each week, we answer a different question about Clojure and functional programming.

                            If you have a question 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 question is: "How can I save my data from serialization?" We record our thoughts on the many trade-offs we have encountered preserving our data when it leaves our programs.

                            Selected quotes:

                            • "Clojure has the best data structures on the planet."
                            • "One of the reasons why JSON is so popular is because XML was so overbearingly hard."
                            • "XML decided that trees aren't dimensional enough, so they added another dimension in attributes."
                            • "Serialization formats aren't for humans, Nate, what are you talking about?!"
                            • "EDN isn't horrible to look at because it's just Clojure data structures."
                            • "We don't want freezer burn!"
                            • Related episodes:

                              • 014: Fiddle with the REPL
                              • Links:

                                • EDN
                                • Transit
                                • Nippy
                                • Fressian
                                • fress: Fressian for Clojure(Script) AND WASM!
                                • 31 min
                                • Ep 052: Functions! Functions! Functions!

                                  Each week, we discuss a different topic about Clojure and functional programming.

                                  If you have a question 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, our topic is: "Functions! Functions! Functions!" We wonder how we could function without these critical building blocks, so we catagorize their varied uses.

                                  Selected quotes:

                                  • "Functions put the fun in functional."
                                    • "Each function category has a different mindset."
                                    • "Programming is more fun when you're only thinking about the problem in front of you."
                                    • "Naming bits of computation helps you understand an abstraction without having to dip into it."
                                    • "So you don't want the function to be called 'write-or-fetch-or-sleep-or-return!'?"
                                    • "Side effecting functions shouldn't think. They are grunts."
                                    • "The I/O fairy hands you data, and you get it all transformed with pure functions, and then you hand it back to the I/O fairy."
                                    • "That Twitter use case, that has a lot more side effects."
                                    • Related episodes:

                                      • 002: Tic-Tac-Toe, State in a Row
                                      • 024: You Are Here, But Why?
                                      • 38 min
                                      • Ep 051: Maps! Maps! Maps!

                                        Each week, we discuss a different topic about Clojure and functional programming.

                                        If you have a question 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, our topic is: "Maps! Maps! Maps!" We discuss maps and their useful features, including a key distinction that we couldn't live without.

                                        Selected quotes:

                                        • "Working with Clojure makes you feel like you're living in the future!"
                                        • "Maps are bags of dimensions."
                                          • "The namespace of the key is the entity, the name is the attribute, and the value is the value."
                                            • "Flatter maps make it so you end up writing less code."
                                            • Related episodes:

                                              • Time Log series:
                                                • 015: Finding the Time
                                                • 016: When 8 - 1 = 6
                                                • 017: Data, at Your Service
                                                • 018: Did I Work Late on Tuesday?
                                                • 019: Dazed by Weak Weeks
                                                • 020: Data Dessert
                                                • 049: Keywords! Keywords! Keywords!
                                                • Links:

                                                  • Love Letter To Clojure (Part 1) - Gene Kim
                                                  • Code sample:

                                                    ;; Player records: one nested, one with rich keys.
                                                    (def players-nested
                                                    [{:player {:id 123
                                                    :name "Russell"
                                                    :position :point-guard}
                                                    :team {:id 432
                                                    :name "Durham Denizens"
                                                    :division :eastern}}
                                                    {:player {:id 124
                                                    :name "Frank"
                                                    :position :midfield}
                                                    :team {:id 432
                                                    :name "Durham Denizens"
                                                    :division :eastern}}])
                                                    (def players-rich
                                                    [{:player/id 123
                                                    :player/name "Russell"
                                                    :player/position :point-guard
                                                    :team/id 432
                                                    :team/name "Durham Denizens"
                                                    :team/division :eastern}
                                                    {:player/id 124
                                                    :player/name "Frank"
                                                    :player/position :midfield
                                                    :team/id 432
                                                    :team/name "Durham Denizens"
                                                    :team/division :eastern}])
                                                    ;; Extract player and team id, along with team name
                                                    ; Nested
                                                    (defn extract
                                                    [player]
                                                    (let [{:keys [player team]} player]
                                                    {:player (select-keys player [:id])
                                                    :team (select-keys team [:id :name])}))
                                                    #_(map extract players-nested)
                                                    ; ({:player {:id 123}, :team {:id 432, :name "Durham Denizens"}}
                                                    ; {:player {:id 124}, :team {:id 432, :name "Durham Denizens"}})
                                                    ; Rich
                                                    #_(map #(select-keys % [:player/id :team/id :team/name]) players-rich)
                                                    ; ({:player/id 123, :team/id 432, :team/name "Durham Denizens"}
                                                    ; {:player/id 124, :team/id 432, :team/name "Durham Denizens"})
                                                    ;; Sort by team name and then player name
                                                    ; Nested
                                                    #_(sort-by (juxt #(-> % :team :name) #(-> % :player :name)) players-nested)
                                                    ; ({:player {:id 124, :name "Frank", :position :midfield},
                                                    ; :team {:id 432, :name "Durham Denizens", :division :eastern}}
                                                    ; {:player {:id 123, :name "Russell", :position :point-guard},
                                                    ; :team {:id 432, :name "Durham Denizens", :division :eastern}})
                                                    ; Rich
                                                    #_(sort-by (juxt :team/name :player/name) players-rich)
                                                    ; ({:player/id 124,
                                                    ; :player/name "Frank",
                                                    ; :player/position :midfield,
                                                    ; :team/id 432,
                                                    ; :team/name "Durham Denizens",
                                                    ; :team/division :eastern}
                                                    ; {:player/id 123,
                                                    ; :player/name "Russell",
                                                    ; :player/position :point-guard,
                                                    ; :team/id 432,
                                                    ; :team/name "Durham Denizens",
                                                    ; :team/division :eastern})
                                                    29 min
                                                  • Ep 050: Parentheses! Parentheses! Parentheses!

                                                    Each week, we discuss a different topic about Clojure and functional programming.

                                                    If you have a question 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, our topic is: "Parentheses! Parentheses! Parentheses!" We defend the lowly parentheses, and discuss the benefits of having this stalwart shepherd dutifully organizing our code.

                                                    Selected quotes:

                                                    • "I'm converting my visual cues into audio information."
                                                    • "Parentheses are like dust bunnies that have stacked up over time."
                                                    • "Pounds of parentheses."
                                                    • "The parenthesis is greatly misunderstood."
                                                    • "Parentheses make the grammar of the language incredibly simple."
                                                    • "I've never seen that in math, at least not in normal math."
                                                    • "If you have 15 close parentheses, you might have to do some refactoring."
                                                    • "Parentheses are the hugs your program needs."
                                                    • "Peace, Love, Parentheses."
                                                    • 28 min

                                                    About Functional Design in Clojure

                                                    From the publisher's feed

                                                    Each week, we discuss a software design problem and how we might solve it using functional principles and the Clojure programming language.