Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Cracking clojure

4 010 vues

Publié le

Maybe you've heard of Clojure, one of those new-fangled JVM languages. How does anybody get any work done in a language like that? What's up with all those parentheses?
If you're coming from Java and OOP, Clojure can indeed feel disorienting. In this talk we'll demystify the basics of Clojure and dissect the source of its power. Functional programming is on the rise and Clojure is indeed a functional language, but we'll learn the real secret sauce that makes cooking with Clojure fun.
We'll look at how to translate concepts you know in Java (like domain objects, interfaces, collections, and concurrency) into their natural Clojure equivalents. And more importantly, we'll learn how these components interact to make Clojure a beautiful language for building abstractions.
No prior knowledge of Clojure or functional programming is assumed... Clojure novices welcome!

Publié dans : Business
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Dating direct: ❶❶❶ http://bit.ly/2F4cEJi ❶❶❶
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Sex in your area is here: ❤❤❤ http://bit.ly/2F4cEJi ❤❤❤
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Cracking clojure

  1. 1. Cracking ClojureAlex MillerRevelytix
  2. 2. Clojure• A Lisp on the JVM (also ClojureScript on JavaScript)• Dynamic (types, code, etc)• Functional language• Compiled (there is no interpreter)• Immutability and state management• Code is data• REPL - Read / Eval / Print / Loop• Interactive development 2
  3. 3. It looks like this... (defn neighbors [[x y]] (for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])] [(+ dx x) (+ dy y)])) (defn live [n alive?] (or (= n 3) (and (= n 2) alive?))) (defn step [world] (set (for [[cell n] (frequencies (mapcat neighbors world)) :when (live n (world cell))] cell))) (defn life [initial-world] (iterate step initial-world)) 3
  4. 4. Primitives 4
  5. 5. Collections 5
  6. 6. Sequences 6
  7. 7. Sequences 6
  8. 8. Functions 7
  9. 9. Functions 7
  10. 10. Functions 7
  11. 11. Compiler 8
  12. 12. Casting spells 9
  13. 13. Creating functions 10
  14. 14. Creating functions 10
  15. 15. Creating functions 10
  16. 16. Creating functions 10
  17. 17. Creating functions 10
  18. 18. An example... 11
  19. 19. map 12
  20. 20. Sequence of lines 13
  21. 21. Sequence of files 14
  22. 22. Sequence of files 14
  23. 23. Sequence functions 15
  24. 24. You 16
  25. 25. Lazy sequences 17
  26. 26. 18
  27. 27. 18
  28. 28. Power 19
  29. 29. Objects 20
  30. 30. Maps as cheap objects 21
  31. 31. Records 22
  32. 32. Javapackage domain; int result = 1; result = prime * result + Float.floatToIntBits(alcohol);public class Beer { result = prime * result + ((beer == null) ? 0 : beer.hashCode()); private String beer; result = prime * result + ((brewery == null) ? 0 : private String brewery; brewery.hashCode()); private float alcohol; result = prime * result + ibu; private int ibu; return result; } public Beer(String beer, String brewery, float alcohol, int ibu) { super(); @Override this.beer = beer; public boolean equals(Object obj) { this.brewery = brewery; if (this == obj) this.alcohol = alcohol; return true; this.ibu = ibu; if (obj == null) } return false; if (getClass() != obj.getClass()) public String getBeer() { return false; return beer; Beer other = (Beer) obj; } if (Float.floatToIntBits(alcohol) != Float public String getBrewery() { .floatToIntBits(other.alcohol)) return brewery; return false; } if (beer == null) { public float getAlcohol() { if (other.beer != null) return alcohol; return false; } } else if (!beer.equals(other.beer)) public int getIbu() { return false; return ibu; if (brewery == null) { } if (other.brewery != null) public void setBeer(String beer) { return false; this.beer = beer; } else if (!brewery.equals(other.brewery)) } return false; public void setBrewery(String brewery) { if (ibu != other.ibu) this.brewery = brewery; return false; } return true; public void setAlcohol(float alcohol) { } this.alcohol = alcohol; } @Override public void setIbu(int ibu) { public String toString() { this.ibu = ibu; return "Beer [beer=" + beer + ", brewery=" + brewery + ", } alcohol=" + alcohol + ", ibu=" + ibu + "]"; } @Override } public int hashCode() { final int prime = 31; 23
  33. 33. Javapackage domain; int result = 1; result = prime * result + Float.floatToIntBits(alcohol);public class Beer { result = prime * result + ((beer == null) ? 0 : beer.hashCode()); private String beer; result = prime * result + ((brewery == null) ? 0 : private String brewery; brewery.hashCode()); private float alcohol; Fields and types result = prime * result + ibu; private int ibu; } return result; Hashing public Beer(String beer, String brewery, float alcohol, int ibu) { super(); @Override this.beer = beer; public boolean equals(Object obj) { this.brewery = brewery; this.alcohol = alcohol; Construction if (this == obj) return true; Equality this.ibu = ibu; if (obj == null) } return false; if (getClass() != obj.getClass()) public String getBeer() { return false; return beer; Beer other = (Beer) obj; } if (Float.floatToIntBits(alcohol) != Float public String getBrewery() { .floatToIntBits(other.alcohol)) return brewery; return false; } public float getAlcohol() { Getters if (beer == null) { if (other.beer != null) return alcohol; return false; } } else if (!beer.equals(other.beer)) public int getIbu() { return false; return ibu; if (brewery == null) { } if (other.brewery != null) public void setBeer(String beer) { return false; this.beer = beer; } else if (!brewery.equals(other.brewery)) } return false; public void setBrewery(String brewery) { if (ibu != other.ibu) this.brewery = brewery; return false; } return true; public void setAlcohol(float alcohol) { this.alcohol = alcohol; Setters } } @Override public void setIbu(int ibu) { public String toString() { this.ibu = ibu; return "Beer [beer=" + beer + ", brewery=" + brewery + ", } alcohol=" + alcohol + ", ibu=" + ibu + "]"; Printing } @Override } public int hashCode() { final int prime = 31; 23
  34. 34. Data interfaces 24
  35. 35. Data interfaces 24
  36. 36. Data interfaces 25
  37. 37. Data - Clojure vs Java 26
  38. 38. Data - Clojure vs Java 26
  39. 39. Polymorphism 27
  40. 40. Generic access FTW 28
  41. 41. Multimethods 29
  42. 42. Multimethod dispatch 30
  43. 43. Protocols 31
  44. 44. State 32
  45. 45. Atoms 33
  46. 46. Refs 34
  47. 47. Agents 35
  48. 48. Destructuring 36
  49. 49. for comprehensions 37
  50. 50. for comprehensions 37
  51. 51. Macros 38
  52. 52. Macros 39
  53. 53. Review CONCURRENCY HOST DATA CODE 40
  54. 54. Review CONCURRENCY HOST DATA CODE primitives 40
  55. 55. Review CONCURRENCY HOST DATA CODE collections primitives 40
  56. 56. Review CONCURRENCY HOST sequences DATA CODE collections primitives 40
  57. 57. Review CONCURRENCY HOST laziness sequences DATA CODE collections primitives 40
  58. 58. Review CONCURRENCY HOST laziness sequences FP DATA CODE collections primitives 40
  59. 59. Review CONCURRENCY HOST laziness sequence library sequences FP DATA CODE collections primitives 40
  60. 60. Review CONCURRENCY HOST laziness sequence library sequences FP records types DATA CODE collections primitives 40
  61. 61. Review CONCURRENCY HOST laziness sequence library sequences multimethods FP protocols records types DATA CODE collections primitives 40
  62. 62. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types DATA CODE collections primitives 40
  63. 63. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types DATA CODE collections primitives destructuring 40
  64. 64. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types DATA macros CODE collections primitives destructuring 40
  65. 65. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types DATA macros CODE metadata collections primitives destructuring transients 40
  66. 66. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types DATA macros CODE metadata collections namespaces primitives destructuring transients 40
  67. 67. Review refs agentsatoms CONCURRENCY HOST state laziness sequence library sequences multimethods FP protocols records types recursion DATA macros CODE metadata collections namespaces primitives destructuring transients 40
  68. 68. Review refs agentsatoms CONCURRENCY HOST state Java libs laziness sequence library Java sequences interop multimethods FP protocols records types recursion DATA macros CODE metadata collections namespaces primitives destructuring transients 40
  69. 69. Review futures promises refs agentsatoms pmap CONCURRENCY HOST state Java libs laziness sequence library Java sequences interop multimethods FP protocols records types recursion DATA macros CODE metadata collections namespaces primitives destructuring transients 40
  70. 70. Conways Life Lifes rules: If alive and 2 or 3 neighbors Then stay alive Else die If dead and 3 neighbors Then come to life "Blinker" configuration Implementation courtesy of Christophe Grand http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/ 41
  71. 71. Thanks! • Twitter: @puredanger • Blog: http://tech.puredanger.com • Work: http://revelytix.com • My conferences – Strange Loop - http://thestrangeloop.com – Clojure/West - http://clojurewest.com If you want to pair on Clojure during Devoxx, ping me on Twitter! 43

×