Programming in Scala

Total Page:16

File Type:pdf, Size:1020Kb

Programming in Scala A comprehensive step-by-step guide Programming in Scala Martin Odersky Lex Spoon artima Bill Venners Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Programming in Scala PrePrint™ Edition Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index iii Thank you for purchasing the PrePrint™ Edition of Programming in Scala. A PrePrint™ is a work-in-progress, a book that has not yet been fully written, reviewed, edited, or formatted. We are publishing this book as a PrePrint™ for two main reasons. First, even though this book is not quite finished, the information contained in its pages can already provide value to many readers. Second, we hope to get reports of errata and suggestions for improvement from those readers while we still have time incorporate them into the first printing. As a PrePrint™ customer, you’ll be able to download new PrePrint™ versions from Artima as the book evolves, as well as the final PDF of the book once finished. You’ll have access to the book’s content prior to its print publication, and can participate in its creation by submitting feedback. Please submit by clicking on the Suggest link at the bottom of each page. Thanks for your participation. We hope you find the book useful and enjoyable. Bill Venners President, Artima, Inc. Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Programming in Scala PrePrint™ Edition Martin Odersky, Lex Spoon, Bill Venners artima ARTIMA PRESS MOUNTAIN VIEW,CALIFORNIA Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index v Programming in Scala PrePrint™ Edition Version 2 Martin Odersky is the creator of the Scala language and a professor at EPFL in Lausanne, Switzerland. Lex Spoon worked on Scala for two years as a post-doc with Martin Odersky. Bill Venners is president of Artima, Inc. Artima Press is an imprint of Artima, Inc. P.O. Box 390122, Mountain View, California 94039 Copyright © 2007, 2008 Martin Odersky, Lex Spoon, and Bill Venners. All rights reserved. PrePrint™ Edition first published 2007 Version 2 published February 18, 2008 Produced in the United States of America 12 11 10 09 08 2 3 4 5 6 No part of this publication may be reproduced, modified, distributed, stored in a retrieval system, republished, displayed, or performed, for commercial or noncommercial purposes or for compensation of any kind without prior written permission from Artima, Inc. All information and materials in this book are provided "as is" and without warranty of any kind. The term “Artima” and the Artima logo are trademarks or registered trademarks of Artima, Inc. All other company and/or product names may be trademarks or registered trademarks of their owners. Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index to Nastaran - M.O. to Fay - L.S. to Siew - B.V. Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Overview Contents viii Preface xvi Acknowledgments xvii Introduction xx 1. A Scalable Language 27 2. First Steps in Scala 47 3. Next Steps in Scala 63 4. Classes and Objects 90 5. Basic Types and Operations 114 6. Functional Objects 136 7. Built-in Control Structures 151 8. Functions and Closures 169 9. Control Abstraction 190 10. Composition and Inheritance 205 11. Traits and Mixins 233 12. Case Classes and Pattern Matching 249 13. Packages and Imports 279 14. Working with Lists 292 15. Collections 322 16. Stateful Objects 342 17. Type Parameterization 362 18. Abstract Members and Properties 379 19. Implicit Conversions and Parameters 396 20. Implementing Lists 413 21. Object Equality 424 22. Working with XML 438 23. Actors and Concurrency 450 24. Extractors 461 25. Objects As Modules 473 26. Annotations 484 27. Combining Scala and Java 490 28. Combinator Parsing 502 Glossary 530 Bibliography 544 About the Authors 546 Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Contents Contents viii Preface xvi Acknowledgments xvii Introduction xx 1 A Scalable Language 27 1.1 A language that grows on you ................ 28 1.2 What makes Scala scalable? ................. 33 1.3 Why Scala?.......................... 36 1.4 Scala’s roots.......................... 44 1.5 Conclusion .......................... 45 2 First Steps in Scala 47 Step 1. Learn to use the Scala interpreter.............. 47 Step 2. Define some variables.................... 49 Step 3. Define some functions ................... 51 Step 4. Write some Scala scripts.................. 55 Step 5. Loop with while, decide with if . 57 Step 6. Iterate with foreach and for . 59 Conclusion ............................. 62 3 Next Steps in Scala 63 Step 7. Understand the importance of vals............. 63 Step 8. Parameterize Arrays with types .............. 65 Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Contents ix Step 9. Use Lists and Tuples ................... 69 Step 10. Use Sets and Maps..................... 74 Step 11. Understand classes and singleton objects......... 79 Step 12. Understand traits and mixins ............... 86 Conclusion ............................. 89 4 Classes and Objects 90 4.1 Objects and variables..................... 91 4.2 Mapping to Java........................ 93 4.3 Classes and types....................... 96 4.4 Fields and methods...................... 97 4.5 Class documentation .....................102 4.6 Variable scope.........................104 4.7 Semicolon inference .....................108 4.8 Singleton objects .......................110 4.9 A Scala application......................111 4.10 Conclusion ..........................113 5 Basic Types and Operations 114 5.1 Some basic types .......................115 5.2 Literals ............................116 5.3 Operators are methods ....................121 5.4 Arithmetic operations.....................125 5.5 Relational and logical operations . 126 5.6 Object equality ........................128 5.7 Bitwise operations ......................130 5.8 Operator precedence and associativity . 131 5.9 Rich wrappers.........................133 5.10 Conclusion ..........................134 6 Functional Objects 136 6.1 A class for rational numbers . 136 6.2 Choosing between val and var . 138 6.3 Class parameters and constructors . 139 6.4 Multiple constructors.....................140 6.5 Reimplementing the toString method . 141 6.6 Private methods and fields ..................142 Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Contentsx 6.7 Self references ........................143 6.8 Defining operators ......................143 6.9 Identifiers in Scala ......................145 6.10 Method overloading......................147 6.11 Going further .........................148 6.12 A word of caution.......................149 6.13 Conclusion ..........................150 7 Built-in Control Structures 151 7.1 If expressions.........................152 7.2 While loops..........................154 7.3 For expressions........................156 7.4 Try expressions........................161 7.5 Match expressions ......................164 7.6 Living without break and continue . 166 7.7 Conclusion ..........................168 8 Functions and Closures 169 8.1 Methods............................169 8.2 Nested functions .......................171 8.3 First-class functions......................172 8.4 Short forms of function literals . 175 8.5 Placeholder syntax ......................175 8.6 Partially applied functions ..................177 8.7 Closures............................181 8.8 Repeated parameters .....................184 8.9 Tail recursion.........................185 8.10 Conclusion ..........................189 9 Control Abstraction 190 9.1 Reducing code duplication ..................190 9.2 Simplifying client code....................194 9.3 Currying............................196 9.4 Writing new control structures . 198 9.5 By-name parameters .....................201 9.6 Conclusion ..........................204 Prepared for jacques weiss Cover· Overview· Contents· Discuss· Suggest· Glossary· Index Contents xi 10 Composition and Inheritance 205 10.1 Introduction..........................205 10.2 Abstract classes........................206 10.3 The Uniform Access Principle . 207 10.4 Assertions and assumptions..................209 10.5 Subclasses...........................210 10.6 Two name spaces, not four ..................211 10.7 Class parameter fields.....................213 10.8 More method implementations . 214 10.9 Private helper methods ....................215 10.10Imperative or functional?...................216 10.11Adding other subclasses ...................218 10.12Override modifiers and the fragile base class problem . 219 10.13Factories............................221 10.14Putting it all together .....................222 10.15Scala’s class hierarchy ....................225 10.16Implementing primitives ...................229 10.17Bottom types .........................231 10.18Conclusion ..........................232 11 Traits and Mixins 233 11.1 Syntax.............................233 11.2 Thin versus thick interfaces..................235 11.3 The standard Ordered trait..................236 11.4 Traits for modifying interfaces . 238 11.5 Stacking modifications ....................241 11.6 Locking and logging queues . 242 11.7 Traits versus multiple inheritance . 245 11.8 To trait, or not to trait? ....................247
Recommended publications
  • Scala Tutorial
    Scala Tutorial SCALA TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Scala Tutorial Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. Scala has been created by Martin Odersky and he released the first version in 2003. Scala smoothly integrates features of object-oriented and functional languages. This tutorial gives a great understanding on Scala. Audience This tutorial has been prepared for the beginners to help them understand programming Language Scala in simple and easy steps. After completing this tutorial, you will find yourself at a moderate level of expertise in using Scala from where you can take yourself to next levels. Prerequisites Scala Programming is based on Java, so if you are aware of Java syntax, then it's pretty easy to learn Scala. Further if you do not have expertise in Java but you know any other programming language like C, C++ or Python, then it will also help in grasping Scala concepts very quickly. Copyright & Disclaimer Notice All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] TUTORIALS POINT Simply Easy Learning Table of Content Scala Tutorial ..........................................................................
    [Show full text]
  • 1 Aliasing and Immutability
    Vocabulary: Accessors & Mutators Computer Science and Engineering The Ohio State University Accessor: A method that reads, but never changes, the Aliasing and Immutability (abstract) state of an object Computer Science and Engineering College of Engineering The Ohio State University Concrete representation may change, so long as change is not visible to client eg Lazy initialization Examples: getter methods, toString Lecture 8 Formally: restores “this” Mutator method: A method that may change the (abstract) state of an object Examples: setter methods Formally: updates “this” Constructors not considered mutators A Fixed Epoch Interface A Broken Time Period Class Computer Science and Engineering The Ohio State University Computer Science and Engineering The Ohio State University // Interface cover story goes here public class Period implements FixedEpoch { // Mathematical modeling … private Date start; // constructor private Date end; // requires start date < end date // initializes start and end dates // operations have specifications based on the model public Period(Date start, Date end) { // exercises … this.start = start; this.e nd = e nd; public interface FixedEpoch { } public Date getStart(); public Date getEnd(); } public Date getStart() { return start; } public Date getEnd() { return end; } } Problem: Aliasing A Better Period Class Computer Science and Engineering The Ohio State University Computer Science and Engineering The Ohio State University Assignment in constructor creates an alias public class Period
    [Show full text]
  • Functional Programming Inside OOP?
    Functional Programming inside OOP? It’s possible with Python >>>whoami() Carlos Villavicencio ● Ecuadorian θ ● Currently: Python & TypeScript ● Community leader ● Martial arts: 剣道、居合道 ● Nature photography enthusiast po5i Cayambe Volcano, 2021. >>>why_functional_programming ● Easier and efficient ● Divide and conquer ● Ease debugging ● Makes code simpler and readable ● Also easier to test >>>history() ● Functions were first-class objects from design. ● Users wanted more functional solutions. ● 1994: map, filter, reduce and lambdas were included. ● In Python 2.2, lambdas have access to the outer scope. “Not having the choice streamlines the thought process.” - Guido van Rossum. The fate of reduce() in Python 3000 https://python-history.blogspot.com/2009/04/origins-of-pythons-functional-features.html >>>has_django_fp() https://github.com/django/django/blob/46786b4193e04d398532bbfc3dcf63c03c1793cb/django/forms/formsets.py#L201-L213 https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/forms/formsets.py#L316-L328 Immutability An immutable object is an object whose state cannot be modified after it is created. Booleans, strings, and integers are immutable objects. List and dictionaries are mutable objects. Thread safety >>>immutability def update_list(value: list) -> None: def update_number(value: int) -> None: value += [10] value += 10 >>> foo = [1, 2, 3] >>> foo = 10 >>> id(foo) >>> update_number(foo) 4479599424 >>> foo >>> update_list(foo) 10 >>> foo 樂 [1, 2, 3, 10] >>> id(foo) 4479599424 >>>immutability def update_number(value: int) -> None: print(value, id(value)) value += 10 print(value, id(value)) >>> foo = 10 >>> update_number(foo) 10 4478220880 ڃ 4478221200 20 >>> foo 10 https://medium.com/@meghamohan/mutable-and-immutable-side-of-python-c2145cf72747 Decorators They are functions which modify the functionality of other functions. Higher order functions.
    [Show full text]
  • From Perl to Python
    From Perl to Python Fernando Pineda 140.636 Oct. 11, 2017 version 0.1 3. Strong/Weak Dynamic typing The notion of strong and weak typing is a little murky, but I will provide some examples that provide insight most. Strong vs Weak typing To be strongly typed means that the type of data that a variable can hold is fixed and cannot be changed. To be weakly typed means that a variable can hold different types of data, e.g. at one point in the code it might hold an int at another point in the code it might hold a float . Static vs Dynamic typing To be statically typed means that the type of a variable is determined at compile time . Type checking is done by the compiler prior to execution of any code. To be dynamically typed means that the type of variable is determined at run-time. Type checking (if there is any) is done when the statement is executed. C is a strongly and statically language. float x; int y; # you can define your own types with the typedef statement typedef mytype int; mytype z; typedef struct Books { int book_id; char book_name[256] } Perl is a weakly and dynamically typed language. The type of a variable is set when it's value is first set Type checking is performed at run-time. Here is an example from stackoverflow.com that shows how the type of a variable is set to 'integer' at run-time (hence dynamically typed). $value is subsequently cast back and forth between string and a numeric types (hence weakly typed).
    [Show full text]
  • Declare New Function Javascript
    Declare New Function Javascript Piggy or embowed, Levon never stalemating any punctuality! Bipartite Amory wets no blackcurrants flagged anes after Hercules supinate methodically, quite aspirant. Estival Stanleigh bettings, his perspicaciousness exfoliating sopped enforcedly. How a javascript objects for mistakes to retain the closure syntax and maintainability of course, written by reading our customers and line? Everything looks very useful. These values or at first things without warranty that which to declare new function javascript? You declare a new class and news to a function expressions? Explore an implementation defined in new row with a function has a gas range. If it allows you probably work, regular expression evaluation but mostly warszawa, and to retain the explanation of. Reimagine your namespaces alone relate to declare new function javascript objects for arrow functions should be governed by programmers avoid purity. Js library in the different product topic and zip archives are. Why is selected, and declare a superclass method decorators need them into functions defined by allocating local time. It makes more sense to handle work in which support optional, only people want to preserve type to be very short term, but easier to! String type variable side effects and declarations take a more situations than or leading white list of merchantability or a way as explicit. You declare many types to prevent any ecmascript program is not have two categories by any of parameters the ecmascript is one argument we expect. It often derived from the new knowledge within the string, news and error if the function expression that their prototype.
    [Show full text]
  • Reactive Programming with Scala, Lagom, Spark, Akka and Play
    Issue October 2016 | presented by www.jaxenter.com #53 The digital magazine for enterprise developers Reactive Programming with Scala, Lagom, Spark, Akka and Play Interview with Scala creator Martin Odersky The state of Scala The Lagom Framework Lagom gives the developer a clear path DevOpsCon 2016: Our mission statement This is how we interpret modern DevOps ©istockphoto.com/moorsky Editorial Reactive programming is gaining momentum “We believe that a coherent approach to systems architec- If the definition “stream of events” does not satisfy your ture is needed, and we believe that all necessary aspects are thirst for knowledge, get ready to find out what reactive pro- already recognized individually: we want systems that are Re- gramming means to our experts in Scala, Lagom, Spark, Akka sponsive, Resilient, Elastic and Message Driven. We call these and Play. Plus, we talked to Scala creator Martin Odersky Reactive Systems.” – The Reactive Manifesto about the impending Scala 2.12, the current state of this pro- Why should anyone adopt reactive programming? Because gramming language and the technical innovations that await it allows you to make code more concise and focus on im- us. portant aspects such as the interdependence of events which Thirsty for more? Open the magazine and see what we have describe the business logic. Reactive programming means dif- prepared for you. ferent things to different people and we are not trying to rein- vent the wheel or define this concept. Instead we are allowing Gabriela Motroc, Editor our authors to prove how Scala, Lagom, Spark, Akka and Play co-exist and work together to create a reactive universe.
    [Show full text]
  • Enforcing Abstract Immutability
    Enforcing Abstract Immutability by Jonathan Eyolfson A thesis presented to the University of Waterloo in fulfillment of the thesis requirement for the degree of Doctor of Philosophy in Electrical and Computer Engineering Waterloo, Ontario, Canada, 2018 © Jonathan Eyolfson 2018 Examining Committee Membership The following served on the Examining Committee for this thesis. The decision of the Examining Committee is by majority vote. External Examiner Ana Milanova Associate Professor Rensselaer Polytechnic Institute Supervisor Patrick Lam Associate Professor University of Waterloo Internal Member Lin Tan Associate Professor University of Waterloo Internal Member Werner Dietl Assistant Professor University of Waterloo Internal-external Member Gregor Richards Assistant Professor University of Waterloo ii I hereby declare that I am the sole author of this thesis. This is a true copy of the thesis, including any required final revisions, as accepted by my examiners. I understand that my thesis may be made electronically available to the public. iii Abstract Researchers have recently proposed a number of systems for expressing, verifying, and inferring immutability declarations. These systems are often rigid, and do not support “abstract immutability”. An abstractly immutable object is an object o which is immutable from the point of view of any external methods. The C++ programming language is not rigid—it allows developers to express intent by adding immutability declarations to methods. Abstract immutability allows for performance improvements such as caching, even in the presence of writes to object fields. This dissertation presents a system to enforce abstract immutability. First, we explore abstract immutability in real-world systems. We found that developers often incorrectly use abstract immutability, perhaps because no programming language helps developers correctly implement abstract immutability.
    [Show full text]
  • Exploring Language Support for Immutability
    Exploring Language Support for Immutability Michael Coblenz∗, Joshua Sunshine∗, Jonathan Aldrich∗, Brad Myers∗, Sam Webery, Forrest Shully May 8, 2016 CMU-ISR-16-106 This is an extended version of a paper that was published at ICSE [11]. Institute for Software Research School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 ∗School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, USA ySoftware Engineering Institute, Carnegie Mellon University, Pittsburgh, PA, USA This material is supported in part by NSA lablet contract #H98230-14-C-0140, by NSF grant CNS-1423054, and by Contract No. FA8721-05-C-0003 with CMU for the operation of the SEI, a federally funded research and development center sponsored by the US DoD. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of any of the sponsors. Keywords: Programming language design, Programming language usability, Immutability, Mutability, Program- mer productivity, Empirical studies of programmers Abstract Programming languages can restrict state change by preventing it entirely (immutability) or by restricting which clients may modify state (read-only restrictions). The benefits of immutability and read-only restrictions in software structures have been long-argued by practicing software engineers, researchers, and programming language designers. However, there are many proposals for language mechanisms for restricting state change, with a remarkable diversity of tech- niques and goals, and there is little empirical data regarding what practicing software engineers want in their tools and what would benefit them. We systematized the large collection of techniques used by programming languages to help programmers prevent undesired changes in state.
    [Show full text]
  • 1 Immutable Classes
    A Broken Time Period Class Computer Science and Engineering The Ohio State University public class Period { private Date start; Immutable Classes private Date end; Computer Science and Engineering College of Engineering The Ohio State University public Period(Date start, Date end) { assert (start.compareTo(end) > 0); //start < end this.start = start; this.end = end; Lecture 8 } public Date getStart() { return start; } public Date getEnd() { return end; } } Questions Problem: Aliasing Computer Science and Engineering The Ohio State University Computer Science and Engineering The Ohio State University What is an invariant in general? Assignment in constructor creates an alias Ans: Client and component both have references to the same Date object Class invariant can be undermined via alias What is an invariant for class Period? Date start = new Date(300); Ans: Date end = new Date (500); Period p = new Period (start, end); end.setTime(100); //modifies internals of p Why is this an invariant for this class? Solution: “defensive copying” Ans: Constructor creates a copy of the arguments Copy is used to initialize the private fields Metaphor: ownership A Better Period Class Good Practice: Copy First Computer Science and Engineering The Ohio State University Computer Science and Engineering The Ohio State University public class Period { private Date start; When making a defensive copy of private Date end; constructor arguments: public Period(Date start, Date end) { First copy the arguments assert (start.compareTo(end) >
    [Show full text]
  • Adding Crucial Features to a Typestate-Oriented Language
    João Daniel da Luz Mota Bachelor in Computer Science and Engineering Coping with the reality: adding crucial features to a typestate-oriented language Dissertation submitted in partial fulfillment of the requirements for the degree of Master of Science in Computer Science and Engineering Adviser: António Maria Lobo César Alarcão Ravara, Associate Professor, NOVA School of Science and Technology Co-adviser: Marco Giunti, Researcher, NOVA School of Science and Technology Examination Committee Chair: Hervé Miguel Cordeiro Paulino, Associate Professor, NOVA School of Science and Technology Rapporteur: Ornela Dardha, Lecturer, School of Computing Science, University of Glasgow Members: António Maria Lobo César Alarcão Ravara Marco Giunti February, 2021 Coping with the reality: adding crucial features to a typestate-oriented lan- guage Copyright © João Daniel da Luz Mota, NOVA School of Science and Technology, NOVA University Lisbon. The NOVA School of Science and Technology and the NOVA University Lisbon have the right, perpetual and without geographical boundaries, to file and publish this dissertation through printed copies reproduced on paper or on digital form, or by any other means known or that may be invented, and to disseminate through scientific repositories and admit its copying and distribution for non-commercial, educational or research purposes, as long as credit is given to the author and editor. Acknowledgements Throughout the writing of this thesis I have received a great deal of support and assis- tance. I would first like to thank my adviser, Professor António Ravara, and co-adviser, Re- searcher Marco Giunti, for the guidance and direction provided. Your feedback was crucial and allowed me to organize my work and write this thesis.
    [Show full text]
  • Scala by Example (2009)
    Scala By Example DRAFT January 13, 2009 Martin Odersky PROGRAMMING METHODS LABORATORY EPFL SWITZERLAND Contents 1 Introduction1 2 A First Example3 3 Programming with Actors and Messages7 4 Expressions and Simple Functions 11 4.1 Expressions And Simple Functions...................... 11 4.2 Parameters.................................... 12 4.3 Conditional Expressions............................ 15 4.4 Example: Square Roots by Newton’s Method................ 15 4.5 Nested Functions................................ 16 4.6 Tail Recursion.................................. 18 5 First-Class Functions 21 5.1 Anonymous Functions............................. 22 5.2 Currying..................................... 23 5.3 Example: Finding Fixed Points of Functions................ 25 5.4 Summary..................................... 28 5.5 Language Elements Seen So Far....................... 28 6 Classes and Objects 31 7 Case Classes and Pattern Matching 43 7.1 Case Classes and Case Objects........................ 46 7.2 Pattern Matching................................ 47 8 Generic Types and Methods 51 8.1 Type Parameter Bounds............................ 53 8.2 Variance Annotations.............................. 56 iv CONTENTS 8.3 Lower Bounds.................................. 58 8.4 Least Types.................................... 58 8.5 Tuples....................................... 60 8.6 Functions.................................... 61 9 Lists 63 9.1 Using Lists.................................... 63 9.2 Definition of class List I: First Order Methods..............
    [Show full text]
  • Lambda Expressions
    Back to Basics Lambda Expressions Barbara Geller & Ansel Sermersheim CppCon September 2020 Introduction ● Prologue ● History ● Function Pointer ● Function Object ● Definition of a Lambda Expression ● Capture Clause ● Generalized Capture ● This ● Full Syntax as of C++20 ● What is the Big Deal ● Generic Lambda 2 Prologue ● Credentials ○ every library and application is open source ○ development using cutting edge C++ technology ○ source code hosted on github ○ prebuilt binaries are available on our download site ○ all documentation is generated by DoxyPress ○ youtube channel with over 50 videos ○ frequent speakers at multiple conferences ■ CppCon, CppNow, emBO++, MeetingC++, code::dive ○ numerous presentations for C++ user groups ■ United States, Germany, Netherlands, England 3 Prologue ● Maintainers and Co-Founders ○ CopperSpice ■ cross platform C++ libraries ○ DoxyPress ■ documentation generator for C++ and other languages ○ CsString ■ support for UTF-8 and UTF-16, extensible to other encodings ○ CsSignal ■ thread aware signal / slot library ○ CsLibGuarded ■ library for managing access to data shared between threads 4 Lambda Expressions ● History ○ lambda calculus is a branch of mathematics ■ introduced in the 1930’s to prove if “something” can be solved ■ used to construct a model where all functions are anonymous ■ some of the first items lambda calculus was used to address ● if a sequence of steps can be defined which solves a problem, then can a program be written which implements the steps ○ yes, always ● can any computer hardware
    [Show full text]