際際滷

際際滷Share a Scribd company logo
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition
Introduction To Functional Programming with Scheme - LeanDog Edition

More Related Content

Editor's Notes

  1. Michael Norton - DocOnDev LeanDog in Cleveland Oh - Agile Coaching, Transformation, Delivery Years of Corporate Living Hell before that; Director/CTO in legal, banking, manufacturing Primary Language is Ruby, plenty of Java, Scheme for fun; gateway drug to Clojure I am uniquely qualified to give this presentation based on two criteria; I wrote it and I have the microphone
  2. SICP Study Groups - twitter conversation -> Jim Weirich, Dave Hoover, others; Software Craftsmanship North America; August 2009 Filled up fast; I started the Gamma Group Who has started this book? Who has completed this book?
  3. Had to put a cap on the size of the group Capped at 15; ended up with 18 Week one - we were all excited and ready to go; did our reading. Introduction - read first section of first chapter; Jim Weirich did a kick-off phone call. Week two - Introduced to atoms and pairs. Reading. Exercises were primarily discussion-based.
  4. Fairly significant drop-off rate Week 3 - Iterative versus Recursive; reading; actual problem sets Week 4 - Pairs, car, cdr, anonymous functions (lambda), linear geometry
  5. Group size leveled out at about, well... 3 Week 5/6; lists, recursion over lists, trees, dotted-tail notation Week 7; sets; union, append, add, subtract, compare, etc.
  6. Week 8 was all about differential equations and derivatives I got lost in the math; 20+ years since I studied calculus There were no more than two of us on the weekly phone calls and I was falling way behind the other two guys. Alpha and Beta merged into a single group of about 5 active people; Gamma continues with the two remaining
  7. May be great for some. I found it relatively unapproachable. Even simple problems were presented in a difficult to consume manner. Given the tremendous dropout rate, I suspect many others felt as I did.
  8. I found these texts to be more approachable Little / Seasoned / Reasoned almost too approachable. Can be considered condescending. 50 pages into Little Schemer, I understood the Scheme list structures and their processing. 50 pages into SICP, I had atoms, pairs, and a nagging sense of self-doubt.
  9. Main Program is a function which receives input and provides output Main program is defined in terms of other functions, which are defined in terms of other functions, and so on. At the lowest level, functions are language primitives Functions are first class
  10. Main Program is a function which receives input and provides output Main program is defined in terms of other functions, which are defined in terms of other functions, and so on. At the lowest level, functions are language primitives Functions are first class
  11. Which means it supports Higher-order functions What are higher order functions? Functions which take functions as parameters and functions that return functions
  12. There are no assignment statements; variables are immutable - purely functional A function call takes input and calculates a result; altering no state in the environment As a result, there are no (or at least considerably fewer) side-effects Technically a purely functional application is impossible; with no side-effects, there is no means of providing input or receiving output. If it did exist, nobody would ever know.
  13. A call to a function can be replaced with its value without changing the application behavior
  14. Recursion is a primary control structure for iteration Some functional languages allow no other loop structure In Scheme, recursion is idiomatic, but there are do and for constructs
  15. Symbolic Expression - convention representing semi-structured data in human-readable form a.k.a - s-expressions Originally intended for data only. M-expressions were supposed to be for methods. Formalization came too late and use of s-expressions was idiomatic for data and methods
  16. Type checking at run-time Perl, JavaScript, Ruby, Python, Objective-C
  17. Computer representation of a mathematical finite sequence or tuple We’re all familiar with this concept; List Objects, Arrays, Linked Lists Functional Languages favor immutability Static list structures - only allows inspection and enumeration
  18. Static Scope - variable always refers to its top-level environment Bindings are able to be understood in isolation; no concern about context of invocation
  19. Static Scope - variable always refers to its top-level environment Bindings are able to be understood in isolation; no concern about context of invocation
  20. Idiomatic to Scheme Scheme does have a do construct, but tail recursion is preferred Last call of function (tail call) is a recursive call - easily transformed to iterations Optimization of stack space allowing for deeper (infinite?) recursion Improves efficiency for complex calls
  21. Idiomatic to Scheme Scheme does have a do construct, but tail recursion is preferred Last call of function (tail call) is a recursive call - easily transformed to iterations Optimization of stack space allowing for deeper (infinite?) recursion Improves efficiency for complex calls
  22. Common Lisp has different namespaces for functions and data Common Lisp allows function and variable to have the same name - requires special notation to refer to a function as a value Scheme data and procedures can be bound and manipulated by same primitives Scheme does support creation/installation of namespaces; out of scope for presentation
  23. What is a Kata? Relatively simple problem domains; repeat them over and over again, learning and improving as you go Relatively simple Kata put together by Roy Osherove
  24. This is a simple description of the requirements There are additional requirements to fail for negatives, improve error messages, exclude numbers greater than a given size, allow multiple delimiters, allow complex delimiters
  25. All set.
  26. All set.
  27. All set.
  28. All set.
  29. All set.
  30. All set.
  31. All set.
  32. Michael Norton - DocOnDev ThoughtWorks for 6 months - currently out of Chicago Office LeanDog out of Cleveland before that Years of Corporate Living Hell before that; Director/CTO in legal, banking, manufacturing Primary Language (for the moment) is Java, some delivery in Ruby, Scheme for fun I am uniquely qualified to give this presentation based on two criteria; I wrote it and I have the microphone
  33. schemeunit is a unit testing framework for Scheme. I am running it in DrScheme, available in the PLT Scheme sight. All made available in the “show notes” Provides capability for test suites. Will show simple tests.
  34. This is exactly what we expected! Let’s make it pass.
  35. schemeunit is a unit testing framework for Scheme. I am running it in DrScheme, available in the PLT Scheme sight. All made available in the “show notes” Provides capability for test suites. Will show simple tests.
  36. Yahoo!
  37. Abbreviated header Added a second test - String with single number should return number
  38. Again; expected. Let’s make it pass.
  39. cond => scheme conditional Like a case or switch statement where the else is our otherwise string-length? => scheme function returns boolean string->number => scheme function
  40. Yahoo!
  41. Abbreviated header Added a second test - String with single number should return number
  42. Again; expected. Let’s make it pass.
  43. cond => scheme conditional Like a case or switch statement where the else is our otherwise string-length? => scheme function returns boolean string->number => scheme function
  44. Yahoo!
  45. This is a simple description of the requirements There are additional requirements to fail for negatives, improve error messages, exclude numbers greater than a given size, allow multiple delimiters, allow complex delimiters
  46. Let’s see if it can do strings with more numbers What do you think?
  47. Got one for free - I don’t necessarily like when that happens
  48. This is a simple description of the requirements There are additional requirements to fail for negatives, improve error messages, exclude numbers greater than a given size, allow multiple delimiters, allow complex delimiters
  49. Now we’ve added the Custom Delimiter
  50. This is exactly what we expected! Let’s make it pass.
  51. We’ve added a parameter to the str-calc function, but this paramater is optional. When not provided, it defaults to a comma as indicated Hash-Whack Notation - escape sequence
  52. So now we have custom delimiter
  53. Now we’ve added the Custom Delimiter
  54. So now we have custom delimiter
  55. Ok - now we have to handle the custom delimiter as a prefix to the string as opposed to as a separate parameter.
  56. Now we’ve added the Custom Delimiter as a prefix I’m going to ask you to take a leap of faith with me in the interest of time.
  57. We’ve added a parameter to the str-calc function, but this paramater is optional. When not provided, it defaults to a comma as indicated Hash-Whack Notation - escape sequence
  58. Delimiter parser was also written as part of this kata Test drove it just as we did all the other code.
  59. I told you....
  60. Yahoo!!
  61. All set.