understanding clo ure j through data
play

understanding clo ure j through data James Reeves @weavejester - PowerPoint PPT Presentation

understanding clo ure j through data James Reeves @weavejester booleanknot disclaimer I'll be telling a few lies disclaimer I'll be telling a few lies simplifications j clo ure a functional programming language a lisp (more on


  1. understanding clo ure 
 j through data James Reeves @weavejester boolean·knot

  2. disclaimer I'll be telling a few lies

  3. disclaimer I'll be telling a few lies simplifications

  4. j clo ure

  5. a functional programming language a lisp (more on that later)

  6. officially targets Java (Clojure) .NET (ClojureCLR) javascript (ClojureScript)

  7. first released in September 2007 by Rich Hickey

  8. let's start with edn

  9. e xtensible d ata n otation

  10. edn ⊆ clojure json ⊆ javascript

  11. json edn 3.14159 3.14159 numbers "hello world" "hello world" strings [1, 2, 3, 4] [1 2 3 4] vectors {"name": "alice"} {"name" "alice"} maps true true booleans null nil nil

  12. collections json [1 2 3] array ordered, random access

  13. collections edn [1 2 3] vector ordered, random access (1 2 3) list ordered set #{1 2 3} unordered, distinct

  14. identifiers json "name" string text data and identifier

  15. identifiers edn "name" string text data keyword :name references itself symbol references something else name

  16. example {:name "Alice" :sex :female universal definition :job cryptographer} might reference job description, benefits, etc

  17. namespaces :status/ready mammal.canine/dog

  18. tags #inst "1985-04-12T23:20:50.52Z" #uuid "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"

  19. tags #color/rgb "e8a433" #color/rgb [232 164 51]

  20. what's the connection to clojure ?

  21. clojure = edn + eval

  22. evaluation most data evaluates to itself eval "foo" "foo" 123 123 [1 2 3] [1 2 3] {:x 1} {:x 1}

  23. evaluation symbols evaluate to a bound value eval pi 3.14159 message "Hello World"

  24. evaluation lists evaluate based on their first element eval (+ 1 1) 2 (and true false) false

  25. evaluation functions evaluate their arguments (+ (* 3 3) (* 4 4)) ⇒ (+ 9 16) ⇒ 25

  26. evaluation macros evaluate their return value (postfix (9 16 +)) ⇒ (+ 9 16) ⇒ 25

  27. homoiconic

  28. homo · iconic the same representation

  29. homo · iconic writing code with data

  30. ♥ clojure data

  31. why such a close relationship?

  32. macros allow us to add new syntax through libraries core.async async programming core.logic logic programming core.typed static typing

  33. but is that the only reason?

  34. “Simple Made Easy”

  35. simple complex why?

  36. simple complex

  37. complexity ≠ cardinality

  38. connections complexity = interlacing coupling

  39. how do we usually deal with complexity ?

  40. mutable state { }

  41. mutable state { }

  42. object { } encapsulates state

  43. object

  44. methods

  45. encapsulation isolates complexity

  46. defensive strategy

  47. what would an offensive strategy look like?

  48. can something have zero complexity?

  49. immutable values

  50. mutable state needed for 1. performance 2. communication across threads

  51. object { }

  52. do we need encapsulation ?

  53. walls are expensive

  54. { }

  55. can we do that?

  56. in distributed environments we often work with immutable values

  57. are there any immediate benefits?

  58. free API getters transformations diffing setters transversal serialisation equality merging deserialisation lensing auditing concurrency

  59. end questions?

Recommend


More recommend