Clojure in a nutshell by James Trunk

Поділитися
Вставка
  • Опубліковано 4 лип 2024
  • Learn the basics of Clojure syntax and functional thinking.
    James Trunk introduces Clojure as a language that separates data from functionality, prioritizing data as a first-class citizen. He discusses the core data structures in Clojure and the advantages of immutability. James also explains how Clojure differs from other languages by making data structures a core part of the language. He demonstrates the "threadlast" macro for a more natural reading of code and highlights Clojure's dynamic and data-driven nature. James showcases examples of data analysis and manipulation using Clojure's functions and introduces the concept of a REPL for real-time code manipulation. He concludes by creating a custom function in Clojure and emphasizing the simplicity and conciseness of Clojure code.
    James Trunk
    Led the Polylith team, invented the metaphors, authored the presentation.
    / james-trunk
    If you want to get featured on the channel and have something to present, please head over to MeetUp and contact the organizers: www.meetup.com/Func-Prog-Sweden
    Video sponsor - Ada Beat
    adabeat.com/
    If you want to spread functional programming and support the channel, buy something from the shop: funcprogsweden.myspreadshop.net/
    #funcprogsweden

КОМЕНТАРІ • 126

  • @mertnuhoglu
    @mertnuhoglu 3 роки тому +38

    This is really a great way of teaching design ideas. The presenter firstly mentions a design principle and then gives examples and reasons that supports the design principle.

  • @user-ey2ei4oz3m
    @user-ey2ei4oz3m 3 роки тому +19

    This was awesome. The thread operator really makes looking at FP code way more palatable for me.

  • @mickeyeng
    @mickeyeng 3 роки тому +19

    Best introduction to Clojure I have seen. Would be great if @Misophistful could create an online course on the Clojure programming language. Brilliant presentation 👍

  • @DjastinFaiht
    @DjastinFaiht 3 роки тому +18

    James you are a wonderful teacher! I still love coding in Clojure after you taught me half a decade ago. Your incredible teaching style with explaining the background and mechanics of the language rather than just how to work with it plus your gentle English charm (e.g. When you got a water refill) and how knowledgable you are makes you the perfect teacher for people who have a similar learning style as me.
    A big whoop whoop and thank you for your presentation!

    • @Misophistful
      @Misophistful 3 роки тому +4

      Thank you so much for your kind words! I have so many fond memories of our Clojure sessions, and to this day I’ve never seen someone pickup the concepts as quickly as you did. I’m so pleased to hear that you still use it!

  • @johnneiberger7311
    @johnneiberger7311 3 роки тому +15

    I tried learning clojure over a year ago and had a very hard time. It was my first attempt at a functional language. I gave up after a couple of weeks. Recently, I've been learning some Erlang and getting a better feel for functional thinking. I wish I had found a teacher who taught clojure this way back when I was trying to learn it. It would have made things so much easier for me. Great job!

  • @Kah0ona
    @Kah0ona 3 роки тому +23

    Great presentation, thanks
    And, fantastic presentational skills! Clear and simple slides, very well articulated.

  • @johnneiberger7311
    @johnneiberger7311 2 роки тому +5

    I know I already commented seven months ago, but I'm watching this again and have to say it's easily the best introduction to clojure I've seen on UA-cam.

  • @euankirkhope5390
    @euankirkhope5390 11 місяців тому +3

    An absolutely amazing presentation. Congrats James, this has to be the clearest and most concise demonstration of any new language I have seen.

  • @mohamedabdulaziz107
    @mohamedabdulaziz107 3 роки тому +41

    What an amazing intro to Clojure! You explained it so well that I was able to pause the video and implement the last thread-last macro example without any help. Really felt like I was playing with legos!
    Loved that you went from the language design principles and showed how it looks like in practice. It was also great seeing the REPL in action and I can definitely see how it could be great for experimenting due to the fast feedback loop.
    Thank you for the presentation James!

    • @Misophistful
      @Misophistful 3 роки тому +1

      Hi Mo, thank you for your kind words, and congratulations on taking your first steps towards Clojure mastery!

  • @simonkeng3908
    @simonkeng3908 3 роки тому +10

    This is an incredible introduction to the design of Clojure and a brilliant tutorial for someone learning Clojure

  • @Frodohack
    @Frodohack 3 роки тому +7

    Is really brilliant how this guy explains the concepts in his own words. Thanks!

  • @gagansrai8137
    @gagansrai8137 3 роки тому +121

    This has to be one of the best "sales pitches" for clojure. How can you watch this and go back to JS/Java/Scala/python etc? Amazing presentation skills as well

    • @RogueTravel
      @RogueTravel 3 роки тому +5

      I thought about that, then I realized that I don't need/want the jvm. Learning elixir and golang instead

    • @gagansrai8137
      @gagansrai8137 3 роки тому +2

      @@RogueTravel I tried go, it's easy, but probably the most boring language ever. Elixir is interesting, but I have no idea about the BEAM VM and OTP. Also writing end everywhere seems annoying 😂 which one is your favourite elixir or go?

    • @sfyire
      @sfyire 3 роки тому +9

      @@RogueTravel JVM is a world class VM but if you don't want it you can run V8 via ClojureScript or .NET via ClojureCLR or substrateVM via babashka or normal Clojure via graalvm (supports polyglot programming)
      There's also lots of unofficial variants for Erlang and others all variants would work the same for the examples in this video

    • @RogueTravel
      @RogueTravel 3 роки тому

      @@sfyire since this comment, I decided on Golang for my back end. The performance is great, pace of development is great. Language is a bit boring but I don't care, it has proven to be a good fit for what I need

    • @RogueTravel
      @RogueTravel 3 роки тому

      @@gagansrai8137 I like elixir better than go, but go fits my needs more

  • @Desi-qw9fc
    @Desi-qw9fc Рік тому +3

    Loving the ->> piping. That plus the list-like basic structure of Lisp makes for a very familiar language to a person like me who loves R.

  • @rauljosegarcia
    @rauljosegarcia Рік тому +8

    This is so freaking cool. I've never been "impressed" by a programming language before. It looks fun.

  • @divakaratanjore1059
    @divakaratanjore1059 3 роки тому +3

    Very precise and deep introduction to Clojure. Thanks you.

  • @karthikraghunathan4742
    @karthikraghunathan4742 2 роки тому +3

    great presentation . functional thinking with Clojure is a powerful drug !

  • @a0um
    @a0um 2 роки тому +4

    3:12 That is *Programming Language * design, and I totally agree. For a statically typed language true to this principle I’ve started learning OCaml and I’m loving it.

  • @Newascap
    @Newascap 2 роки тому +2

    Thank you for this awesome presentation. Truly a hidden gem for the ones like me learning clojure from scratch.

    • @tunesoop7653
      @tunesoop7653 7 місяців тому

      Search on here for 'Misophistful' for more of his [kinda] hidden gems. Helped me a lot. Particularly the destructuring tutorial.

  • @AsifMehedi
    @AsifMehedi 2 роки тому +1

    Brilliant presentation. Thank you.

  • @JubayerKothaBole
    @JubayerKothaBole 8 місяців тому +3

    I never coded in clojure, nor ever tried it. But I was able to catch up the syntaxes immediately. Such a nice presentations.

  • @rodelias9378
    @rodelias9378 2 роки тому +1

    Awesome presentation. Well done!! Thanks a lot!!

  • @stefansalapura6659
    @stefansalapura6659 2 роки тому +1

    Amazing video. Thank you guys!

  • @christopherbennett22
    @christopherbennett22 3 роки тому +4

    Brilliant format :)

  • @esakkisundar
    @esakkisundar 3 роки тому +25

    Great tutorial. The only problem with Clojure is with people having experience with other programming language. There is a bit of unlearning that has to happen to get acquainted with the syntax of Clojure

    • @cswaroop2
      @cswaroop2 2 роки тому +2

      unlearning clojure also has to happen when you go back to non-clojure world like missing , (commas)

    • @caribe_imperial1945
      @caribe_imperial1945 2 роки тому +1

      @@cswaroop2 yeah you start to really get bothered by semicolons and commas and other silly things lol.

    • @Simon-xi8tb
      @Simon-xi8tb 2 роки тому

      @@cswaroop2 tell me about it. I am doing some golang now and I hate every second of it

    • @zed9zed
      @zed9zed 2 роки тому

      It's even worse going the other way. Knowing Clojure will make you absolutely hate some common languages.

    • @Simon-xi8tb
      @Simon-xi8tb 2 роки тому

      @@zed9zed can confirm. I absolutely hate Go. I curse at it daily. It's torture.

  • @ath0006
    @ath0006 3 роки тому +3

    Great presentation! Very useful info.

  • @wildan6335
    @wildan6335 2 роки тому +1

    thank you very much James Trunk!

  • @alexk.6022
    @alexk.6022 Рік тому +1

    Brilliant course. Thank you.

  • @avi3681
    @avi3681 2 роки тому +1

    Excellent live coding demo at the end. Makes me want to try Clojure sometime.

  • @crccrc6
    @crccrc6 3 роки тому +2

    Fantastic presentation!

  • @niallduggan1858
    @niallduggan1858 2 роки тому +2

    Brilliant how after you declare how much you love quotes you tell one yourself on collections being immutable "That gives us a stable base to build upon not a shifting sand of immutability underneath everything we are building"

  • @smokelordo
    @smokelordo 2 роки тому +1

    Beautifully explained.

  • @JoshReighley
    @JoshReighley 3 роки тому +2

    Very well done!

  • @santosharakere
    @santosharakere 2 роки тому +2

    Excellent, thanks.

  • @diegonayalazo
    @diegonayalazo 2 роки тому +2

    Thanks for sharing

  • @daviddelaney363
    @daviddelaney363 9 місяців тому +1

    Nice - I have recently last 2 years been learning Python. I see similarities. And lots of new ideas.

  • @karthikeyanak9460
    @karthikeyanak9460 2 роки тому +1

    Excellent video!

  • @maxgiraldo
    @maxgiraldo 3 роки тому +3

    Great talk

  • @kerron68
    @kerron68 Рік тому

    That was superb!

  • @romanostash822
    @romanostash822 3 роки тому +25

    Thank you for an excellent presentation! May I ask what IDE the presenter was using?

    • @Misophistful
      @Misophistful 3 роки тому +20

      Hi Roman, you're welcome! I used Atom: atom.io with Proto REPL: atom.io/packages/proto-repl . Though I believe Chlorine: atom.io/packages/chlorine has become more popular with Atom-loving Clojure devs recently, as it's more actively maintained than Proto REPL.

    • @romanostash822
      @romanostash822 3 роки тому +5

      @@Misophistful Hi James! I’m using VSCode + Calva plug-in right now. Will definitely try your setup. Thank you!

    • @Misophistful
      @Misophistful 3 роки тому +6

      @Scott Hi Scott, I'm using the theme I designed, called Borealis: github.com/Misophistful/borealis-syntax

    • @Ed-lq9qq
      @Ed-lq9qq 2 роки тому +1

      Does anyone know the color theme he's using ?

    • @ShahJr
      @ShahJr 2 роки тому +2

      Could you tell me what the IDE was? The answer seems to be deleted unfortunately

  • @xaapt
    @xaapt 3 роки тому +1

    really solid talk about clojure

  • @PatClanet
    @PatClanet 3 роки тому +2

    wow, this was a great talk

  • @DanielHorrisberger
    @DanielHorrisberger 2 роки тому +2

    Great Talk!

  • @antoniosousa4178
    @antoniosousa4178 3 роки тому +2

    Very good!

  • @_modiX
    @_modiX 2 роки тому +1

    Great speaker!

  • @hypergraphic
    @hypergraphic 2 роки тому +2

    Coming from Typescript and Go I’m like “where are the type declarations?”. Its kinda cool what you can do without them though. Definitely going to give Clojure a try.

  • @patricsteiner8483
    @patricsteiner8483 3 роки тому +2

    what a sympathetic presenter. good talk :)

  • @sspaeti
    @sspaeti 3 роки тому +1

    This insanely insightful, thank you!

  • @a0um
    @a0um 2 роки тому +3

    4:26 he quotes: “when you combined two pieces of data you get data, when you combine two machines you get trouble“, well
    I’m slightly puzzled. What are the machines? Pure functions? Stateful functions? Objects? Pure modules? Do their interface agree? Static typing or dynamic typing?
    Regarding data: you may get data, consistent or inconsistent data. Maybe a compilation error if the data types don’t match up, maybe a runtime error downstream in case of semi-structured data …
    Definitely a stimulating observation, as it touches the essence of software engineering: designing data and functions and building systems by combining them.
    But you don’t always get trouble if you combine two machines, and merely combining data may just result in nonsense.

  • @ww123ification
    @ww123ification 2 місяці тому

    The Clojure syntax seems to be very interesting, I have not come across anything like that. The equivalent of the code shown at 15:42 in F# will be either [0..4] |> List.map (fun x -> x + 1) |> List.filter (fun x -> x % 2 0) or [0..4] |> List.map ((+) 1) |> List.filter (() 0 >> (%) 2) - both variants look "boringly conventional"😀.

  • @oshinenajarian
    @oshinenajarian 2 роки тому +1

    This is dope!

  • @bufo333
    @bufo333 Рік тому +4

    I would love to see his emacs config file. Loved his theme and they parenthesis module he was using.

    • @rauljosegarcia
      @rauljosegarcia Рік тому

      Yes!

    • @ShahJr
      @ShahJr Рік тому

      Please let us know if you figure it out. I especially liked the parenthesis plugin

    • @ShahJr
      @ShahJr Рік тому

      Looks like it was atom with the theme that's linked in his UA-cam channel but I couldn't find how he did the ghost themed parenthesis matching anywhere

    • @daniellopezgarsco2215
      @daniellopezgarsco2215 10 місяців тому +1

      ​@@ShahJrI believe it was the parinfer-rust plugin.

  • @chakier
    @chakier 8 місяців тому +1

    What a nice IDE James uses. What's the name of this IDE? Sorry for nooby question.

  • @gongfei
    @gongfei 2 роки тому +1

    Thank you for the studio-quality audio and video.
    All over the web, there're too many bad sounded videos since 2020...

  • @Oi-mj6dv
    @Oi-mj6dv 9 місяців тому +1

    After seeing a very large java production codebase whose stack traces looked worse than verdun after the first world war i can 100% feel what rich hickey wanted to avoid. Holy shit does OO under deliver. What a mess.
    PS: after having seen the video now: clojure seems like a thing of beauty. Cant wait to get hands on with it

  • @nielsbom5558
    @nielsbom5558 3 роки тому +2

    Thanks for the talk! I haven’t used Clojure myself but it looks logical and readable.
    What would you say are reasons not to choose Clojure?
    How would you rate its performance, dependency management story, large codebase refactoring (I see no types) and the deployment of Clojure apps?
    Thanks!

    • @thenashbridges
      @thenashbridges 3 роки тому +7

      Clojure is a hosted language, the answers below are for Clojure on JVM:
      - you get a very powerful VM for free. Persistent collections come at a performance cost, but (only if needed) there are many paths to improve the situation in hot loops,
      - you get all Java libs for free. Java interop has no performance penalty and is plain clear. You can also reuse pure Clojure libs which can be fetched as code (eg from github) or as a compiled jar from Maven/clojars. For dependency management there's a built-in tool where you define lib versions in an edn (think of json) file
      - to deploy you compile your project and assets in a uberjar, copy it to a production server and restart JVM
      - there's a limited support for refactoring in tools like cider, perhaps in some IDEs too (I use vim). Despite having no types, Clojure is a compiled language, so any typos/missing declarations are caught immediately, and for me this would be the main source of bugs.
      When not to choose Clojure:
      - when JVM is not acceptable (memory wise or GC wise)
      - when your domain does not have enough libs in Javaland
      Otherwise this is the best language for JVM, period.
      It is a perfect choice for web development.

  • @zed9zed
    @zed9zed 2 роки тому +3

    This was great. The live coding examples were accessible and practical. They certainly illustrate how to get useful things done quickly (and very cleanly). Was that VSCode (with Calva)? If so, I wish I could get mine setup that well.

    • @daveqr
      @daveqr 9 місяців тому

      Was wondering that myself. Actually came to the comments to see if anyone mentioned it.

  • @altoma3562
    @altoma3562 2 роки тому +1

    Does anyone know what IDE or programing program he is using? thanks! Amazing presentation too

    • @vitalipe
      @vitalipe 2 роки тому +3

      atom + proto-repl + parinfer

  • @ivanvincent7534
    @ivanvincent7534 2 роки тому +2

    Really excellent presentation, any anxiety around live coding was well and truely unfounded. I am new to functional programming and find it hard to see the difference around data as a first class citizen compared to object oriented programming. The data appears to be loaded into memory and worked upon in much the same way as one would do with objects in OOP. Can’t see an obvious distinction.

    • @Misophistful
      @Misophistful 2 роки тому +4

      Hi Ivan, with "first class citizen" I primarily mean that data structures have literal representation in Clojure's syntax. In Clojure, you can construct and populate a vector with the code "[1 2 3]", rather than having to construct and then populate an object with something like "ArrayList values = new ArrayList(); values.add(1); values.add(2); values.add(3);"
      This syntax-level representation brings data structures directly into the language, and changes how you think and communicate about data.

  • @EmoPorEmilio
    @EmoPorEmilio 9 місяців тому +1

    what IDE or environment is he using for the live coding?

  • @inanitas
    @inanitas 2 роки тому +1

    Can someone tell me which theme he is using? I want that 😁

  • @kahnfatman
    @kahnfatman Рік тому +2

    It took 10 years for Java books to burn Object Encapsulation into my brain. 5 minutes to wash them all away :D

  • @MECHANISMUS
    @MECHANISMUS 2 роки тому

    nice. what's that editor?

  • @michaelsingh1340
    @michaelsingh1340 9 місяців тому

    @Misophistful, can you describe your VS Code setup? I'd love to replicate it!

  • @AlBakerDev
    @AlBakerDev 2 роки тому +1

    What editor are you using ?

    • @FuncProgSweden
      @FuncProgSweden  2 роки тому +2

      @Misophistful used Atom: atom.io with Proto REPL: atom.io/packages/proto-repl . Though @Misophistful belives Chlorine: atom.io/packages/chlorine has become more popular with Atom-loving Clojure devs recently, as it's more actively maintained than Proto REPL.

  • @lukevin1537
    @lukevin1537 2 роки тому +2

    What are the tools and IDEs used in this video?

    • @FuncProgSweden
      @FuncProgSweden  2 роки тому +4

      @Misophistful uses Atom: atom.io with Proto REPL: atom.io/packages/proto-repl . Though I believe Chlorine: atom.io/packages/chlorine has become more popular with Atom-loving Clojure devs recently, as it's more actively maintained than Proto REPL.

  • @candrar2866
    @candrar2866 Рік тому

    I just realized from the examples above
    Functional programming in clojure done right looks a lot like SQL

    • @candrar2866
      @candrar2866 Рік тому

      One key difference may be SQL is usually composable using a join statement instead of a function
      while clojure is composable with function of functions.

  • @Chris-op7yt
    @Chris-op7yt Рік тому

    looks cool. there are different options for setti ng up working clojure emvironments. i dont know which of the options to choose, and is not that simple to set up..for say Vim editor.

  • @xaapt
    @xaapt 3 роки тому +2

    which IDE does he use?

    • @FuncProgSweden
      @FuncProgSweden  3 роки тому +1

      @Misophistful, James, used Atom: atom.io with Proto REPL: atom.io/packages/proto-repl . Though I believe Chlorine: atom.io/packages/chlorine has become more popular with Atom-loving Clojure devs recently, as it's more actively maintained than Proto REPL.

    • @CalvaTV
      @CalvaTV 3 роки тому +2

      @@FuncProgSweden Han borde använda Calva, tycker jag. 😀 (Haha, j/k, I think it's super nice that people use what they are comfortable with using.)

  • @thiagomiranda3
    @thiagomiranda3 3 роки тому +1

    What IDE are this guy using?

    • @FuncProgSweden
      @FuncProgSweden  3 роки тому +1

      James used Atom: atom.io with Proto REPL: atom.io/packages/proto-repl . Though James believe Chlorine: atom.io/packages/chlorine has become more popular with Atom-loving Clojure devs recently, as it's more actively maintained than Proto REPL.

  • @BenjaminWheeler0510
    @BenjaminWheeler0510 2 роки тому

    Liked for Mandolorian references

  • @RawCoding
    @RawCoding Рік тому

    30:17 nearly took me out

  • @michaelsingh1340
    @michaelsingh1340 9 місяців тому

    Is this Calva?

  • @bitti1975
    @bitti1975 10 місяців тому

    I suspected it's Moby Dick from the load time alone before you revealed the word count. Now you're impressed? (Ok, the truth is, that it's a very common example...)

  • @treeislife
    @treeislife 2 роки тому +1

    "Code as Data" Shouldn't that credit go to John McCarthy?

  • @_xeere
    @_xeere 2 роки тому +1

    “Systems are dynamic and data driven. It might be a nice idea to use a language that is also dynamic and data driven.”
    A brilliant summary of how you can pass utter rubbish for useful advice by making it vague enough and small enough.
    “Our world is filled with objects. It might be a nice idea to have a language that is also filled with objects.”
    Understand why it's wrong now?

    • @Misophistful
      @Misophistful 2 роки тому +2

      You might be being a little uncharitable to Rich Hickey's quote here.
      His quote uses the form "X has properties Y and Z, therefore if we want to build X we should probably use tools that help us with Y and Z." You could potentially refute this claim by arguing that X doesn't actually have the properties Y or Z, or that the suggested tool doesn't help you to achieve Y or Z.
      However, I don't think creating a new quote with the form of "Our world is filled with X, therefore our tool should be filled with X.", demonstrates anything about the accuracy of Rich's claim. Especially when this new form is so easily dismissed with a counter example: "Our world is filled with socks. It might be a nice idea to have a language that is also filled with socks."

    • @_xeere
      @_xeere 2 роки тому

      @@Misophistful I am making the point that the quote is completely meaningless and similar ones have been used in the past to sell things people don't like. He could be entirely correct but nothing in this quote or that video proved it.
      My refutation is that half the words in the sentence are meaningless and they come together in a blatant appeal to naturalism. "Systems" are just as related to programming as the world is.
      The biggest thing this ignores is abstraction. The whole point of programming is to remove most of the properties of the actual system because they are detrimental to understanding it. This is a failure for both the OO quote and the Rich one.
      You have to skirt around this by replacing "tools that are X" with the more reasonable "tools that help with X". Tools with the same properties as problems are really just problems themselves.

  • @EngineerNick
    @EngineerNick 3 роки тому +1

    The ->> operator is something I have never seen before nice way to remove nesting. Lisp is theoretically nice, until you try do anything useful; stupid overabundance of parentheses... I suppose the alternative for a language like this is Haskell where the syntax and order of operations is like dark magic... but why can't we invent a nice ballance? I want to put my + sign between the numbers at least. QWERTY keyboards are to blame i think.

    • @thenashbridges
      @thenashbridges 3 роки тому +5

      First of all, Clojure has a good balance of parens, curlies and brackets (compared to other lisps). As for editing, have a look at parinfer -- it infers syntax from indentation, after that coding in Clojure becomes a breeze.

  • @musicalintuition
    @musicalintuition Рік тому +3

    I'm starting a new job and I'm forced to learn Java. You've ruined it for me. :)

  • @kamleshyadav-yk6hs
    @kamleshyadav-yk6hs Рік тому

    00

  • @jmoz
    @jmoz 2 роки тому

    Too many brackets. If they use syntactic sugar already they could have dropped outer brackets and more. Constantly having to count brackets is annoying and unnecessary.

  • @eygs493
    @eygs493 10 місяців тому +1

    impressive