functional programming
play

Functional Programming in 40 minutes @russolsen Functional - PowerPoint PPT Presentation

Functional Programming in 40 minutes @russolsen Functional Programming in 40 minutes @russolsen Functional Programming Functional Programming Clojure spin Functional Programming 40 Minutes? What is it? What's it like? Does it work?


  1. Functional Programming in 40 minutes @russolsen

  2. Functional Programming in 40 minutes @russolsen

  3. Functional Programming

  4. Functional Programming Clojure spin

  5. Functional Programming 40 Minutes?

  6. What is it? What's it like? Does it work?

  7. What is it? What's it like? Does it work?

  8. FORGET Everything You Know About Programming

  9. What Do You Know?

  10. Names Name = Value Ifs Iteration Procedures

  11. Strings Numerics Booleans Indentation Names Name = Value Ifs Iteration Procedures

  12. Arrays Hashes Namespaces Strings Numerics Booleans Indentation Names Name = Value Ifs Iteration Procedures

  13. Inheritance Classes Methods Arrays Hashes Namespaces Strings Numerics Booleans Indentation Names Name = Value Ifs Iteration Procedures

  14. Programs Inheritance Classes Methods Arrays Hashes Namespaces Strings Numerics Booleans Indentation Names Name = Value Ifs Iteration Procedures

  15. FORGET REALLY? Everything You Know About Programming

  16. Functional Programming

  17. Refactor Everything You Know About Programming

  18. It Works But...

  19. Mess

  20. What About Programming?

  21. During the type erasure process, the Java compiler erases all type parameters and replaces each with its first bound if the type parameter is bounded, or Object if the type parameter is unbounded. https://docs.oracle.com/javase/tutorial/java/generics/genTypes.html

  22. During the type erasure process, the Java compiler erases all type parameters and replaces each with its first bound if the type parameter is bounded, or Object if the type parameter is unbounded.

  23. Protected methods: a protected method is similar to a private method, with the addition that it can be called with, or without, an explicit receiver, but that receiver is always self (it’s defining class) or an object that inherits from self . https://medium.com/@tjoye20/ruby-access-control-basics-public-vs-private-vs-protected- methods-7788b26e04a7

  24. A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions appear in the class definition, friends are not member functions. https://www.tutorialspoint.com/cplusplus/cpp_friend_functions.htm

  25. Programs Inheritance Classes Methods Arrays Hashes Namespaces Strings Numerics Booleans Indentation Names Name = Value Ifs Iteration Procedures

  26. Messy?

  27. Programs Namespaces Arrays Hashes Strings Numerics Booleans Indentation Name = Names Ifs Iteration Value

  28. f(x)

  29. f(x) 2 4 1 6 8 3 4 2 5 10

  30. 2 4 1 6 8 3 4 2 5 10

  31. Methods Procedures Subroutines Functions

  32. 6 3 5 10

  33. 6 3 42 5 10 ??

  34. 6 3 5 10

  35. 6 3 10 5

  36. A Thing f(x)

  37. A Thing I Can Make f(x)

  38. f(x)

  39. 1st Class

  40. Look at Input Produce Output

  41. No Side E ff ects

  42. x = ['a','b','c'] y = a(x) x = ?

  43. x = ['a','b','c'] c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * y = floor(b(x)) + 16 * a(x) - ceil(g(x) - c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x) x = ?

  44. Programs f(x) Namespaces Arrays Hashes Strings Numerics Booleans Indentation Name = Names Ifs Iteration Value

  45. Problem

  46. a b c

  47. a b c

  48. a Q c

  49. x = ['a','b','c'] c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * y = floor(b(x)) + 16 * a(x) - ceil(g(x) - c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x) x = ?

  50. t = c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x) - ceil(g(x) x[2] = 'Q' y = t + c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x)

  51. t = c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x) - ceil(g(x) x[2] = 'Q' y = t + c(a(x) + b(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + d(x) * e(x) - 4 * (q(x) - f(x)) + b(x)) + d(x) / c(a(x) + b(x)) + d(x) * e(x) + g(x) + h(x) * floor(b(x)) + 16 * a(x)

  52. Immutable

  53. a b c a Q c

  54. Problem

  55. Copies Copies Copies

  56. a b c d e f g h i j k l m n o p q r s t u v w x y z !

  57. m n a b c d e f g h i j k l o p q r s t u v w x y z ! m Q a b c d e f g h i j k l o p q r s t u v w x y z !

  58. Persistent Data Structures

  59. a b c d e f g h i j k l m n o p q r s t u v w x y z !

  60. a b c d e f g h i j k l m n o p q r s t u v w x y z !

  61. m Q o

  62. Q m X o

  63. Q m X o

  64. Q a b c d e f g h i j k l m X o p q r s t u v w x y z !

  65. 3

  66. 3

  67. Programs f(x) Namespaces Arrays* Hashes* Strings Numerics Booleans Indentation Name = Names Ifs Iteration Value

  68. Problem

  69. Side E ff ects

  70. SIDE EFFECTS Russ Olsen russ@russolsen.com

  71. EFFECTS Russ Olsen russ@russolsen.com

  72. Atoms 57

  73. Atoms f(x) 57

  74. Atoms f(x) 58

  75. Atoms f(x) 59 g(x)

  76. Atoms f(x) 59 g(x) g(x)

  77. Agents/Actors f(x) some_code(queue) g(x)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend