Papers we love: Elixir edition

Papers we love: Elixir edition

Faafc04d9e69b73b9f49995fd4c94d4d?s=128

Andrea Leopardi

July 16, 2018
Tweet

Transcript

  1. PAPERS WE LOVE ELIXIR EDITION PAPERS WE LOVE ELIXIR EDITION

  2. @whatyouhide

  3. None
  4. None
  5. None
  6. None
  7. None
  8. “You know Yelp? Yeah, but for weed”– me

  9. None
  10. None
  11. “You know Uber Eats?”– me

  12. None
  13. weedmaps.com/careers

  14. ELIXIR functional concurrent fault tolerant

  15. The Elixir core team

  16. we existing research

  17. Formatting code Diffing data structures Property-based testing ⚙

  18. FORMATTING CODE

  19. Code formatter welcoming to newcomers consistency across teams/orgs/community no style

    discussions
  20. print code with line length limit

  21. %{foo: [1, 2, 3], bar: "baz"}

  22. %{foo: [1, 2, 3], bar: "baz"} 30

  23. %{foo: [1, 2, 3], bar: "baz"} 25

  24. %{ foo: [1, 2, 3], bar: "baz" } 25

  25. %{ foo: [1, 2, 3], bar: "baz" } 13

  26. %{ foo: [ 1, 2, 3 ], bar: "baz" }

    13
  27. The Design of a Pretty-printing Library John Hughes

  28. Documents "text" concat(document1, document2) nest(document, columns)

  29. "[" |> concat("1,") |> concat("2,") |> concat("3") |> concat("]") [1,

    2, 3]
  30. "[" |> line("1,") |> line("2,") |> line("3") |> nest(2) |>

    line("]") [ 1, 2, 3 ]
  31. A Prettier Printer Philip Wadler

  32. group( "[" |> concat("1,") |> concat("2,") |> concat("3") |> nest(2)

    |> concat("]") ) [ 1, 2, 3 ]
  33. choose( doc, replace_concat_with_line_break(doc) ) DANGER: STRICT LANGUAGE AHEAD

  34. Strictly Pretty Christian Lindig

  35. Our documents color(doc, :blue) nest(doc, :cursor) ...

  36. DIFFING DATA STRUCTURES

  37. 1) test two strings are different (Test) test.ex:6 Assertion with

    == failed code: assert "hello world!" == "Hello, my world" left: "hello world!" right: "Hello, my world" stacktrace: test.ex:7: (test)
  38. None
  39. An O(ND) Difference Algorithm and Its Variations Eugene W. Myers

  40. “Find the shortest edit script to turn a sequence A

    into a sequence B.” = Find shortest path in a graph
  41. O(ND) D is related to how "similar" the two sequences

    are DNA strand mutation source code changes
  42. iex> List.myers_difference([1, 4, 2, 3], [1, 2, 3, 4]) [eq:

    [1], del: [4], eq: [2, 3], ins: [4]]
  43. Now colorize

  44. No modifications to the paper this time

  45. String Matching with Metric Trees Using an Approximate Distance Ilaria

    Bartolini, Paolo Ciaccia, Marco Patella
  46. PROPERTY-BASED TESTING

  47. Shape of input Properties of output + + Randomness =

    Property-based testing
  48. check all list <- list_of(term()) do sorted = sort(list) assert

    is_list(sorted) assert length(list) == length(sorted) end
  49. String.starts_with?(s1 <> s2, s1) String.ends_with?(s1 <> s2, s2) For any

    strings s1 and s2:
  50. Only Erlang tools (with different license)

  51. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs

    Koen Classen John Hughes
  52. all the base ideas are there but it relies too

    heavily on types
  53. data Colour = Red | Blue | Green instance Arbitrary

    Colour where arbitrary = oneof [return Red, return Blue, return Green]
  54. (prop/for-all [v (gen/vector gen/int)] (= (sort v) (sort (sort v))))

    Clojure's test.check
  55. StreamData check all s1 <- string(), s2 <- string() do

    assert String.starts_with?(s1 <> s2, s1) assert String.ends_with?(s1 <> s2, s2) end
  56. Generators functions that take some random state and return a

    lazy tree
  57. Lazy tree a value plus a "recipe" for shrinking it

  58. StreamData.integer() 3 0 2 0 1 0

  59. StreamData.integer() 3 0 2 0 1 0

  60. map(StreamData.integer(), fn x -> x * 2 end) 3 *

    2 0 * 2 2 * 2 0 * 2 1 * 2 0 * 2
  61. map(StreamData.integer(), fn x -> x * 2 end) 6 0

    4 0 2 0
  62. HONORABLE MENTIONS

  63. How to make ad-hoc polymorphism less ad hoc Philip Wadler

    Stephen Blott
  64. Recursive functions of symbolic expressions and their computation by machine

    John McCarthy
  65. Advances in record linkage methodology as applied to the 1985

    census of Tampa Florida Matthew A. Jaro
  66. Iteratee: Teaching an Old Fold New Tricks John W. Lato

  67. CONCLUSIONS

  68. Existing research is AWESOME

  69. Research tends to solve problems in a general/simple/flexible/elegant way

  70. HDD Hughes-driven development

  71. @whatyouhide