"Specter: overcome your fear of nested Clojure data" by Nathan Marz

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • Clojure revolves around immutable values and manipulation of those values. However, it does not provide good mechanisms for manipulating combinations of those values: like a map of sequences of maps of maps. Code that aims to manipulate these nested data structures complects navigation code with the desired query or transformation. Code like this is painful to write and ugly to read.
    Specter is a library that makes querying and transformation of nested data structures simple, easy, and efficient. At its core it abstracts away the concept of data structure navigation and makes these navigations highly composable. Specter can manipulate any of Clojure's maps, sequences, records, and sets, and by hooking into Specter's protocols you can use it to manipulate any data structure. On top of all this, Specter is highly performant: for example, Specter's equivalent to update-in runs 5x faster. Once you've used Specter, it's hard to imagine programming Clojure without it.
    Nathan Marz
    RED PLANET LABS, INC.
    @nathanmarz
    Nathan is the creator of the open source projects Apache Storm and Cascalog. He is the author of the book "Big Data: principles and best practices of scalable realtime data systems". He was the lead engineer of BackType until BackType was acquired by Twitter. At Twitter, he created the streaming compute team, a core infrastructure team within the company. He left Twitter in 2013 to work on a new startup. When not coding, you can often find him 3500 feet overhead, flying a small plane and enjoying the view.

ความคิดเห็น • 8

  • @trybeingakr
    @trybeingakr 9 ปีที่แล้ว +2

    Woooow; mind blown! The abstraction I never thought I needed.

  • @TorySAnderson
    @TorySAnderson 8 ปีที่แล้ว +2

    Thanks for this! I look forward to using Spectre.

  • @FellshardYT
    @FellshardYT 8 ปีที่แล้ว

    Very concise abstractions!

  • @drakezhard
    @drakezhard 9 ปีที่แล้ว +1

    Why didn't he just use datomic's api? Datalog is really expressive and can query edn.

    • @RobertMedeiros
      @RobertMedeiros 8 ปีที่แล้ว +1

      +Ricardo Acuna Is there a standalone library implementation of Datalog we can use for this purpose right now? If so, do want.

    • @drakezhard
      @drakezhard 8 ปีที่แล้ว +1

      Datascript does that tonsky.me/blog/datascript-internals/, but you can use Datomic Free too for the same purpose.

    • @poppybrosjunior
      @poppybrosjunior 7 ปีที่แล้ว

      because he was demonstrating his library

    • @drakezhard
      @drakezhard 7 ปีที่แล้ว

      Robert Spurrier you're right I was just being petty.