Swift, functional programming, and does it matter? Alexis
|
|
- Garry Clarke
- 6 years ago
- Views:
Transcription
1 Swift, functional programming, and does it matter? Alexis
2 Questions What s new in Swift? Is Swift a functional programming language? And what is functional anyway? How useful is this really?
3 What's'hardly'new'in'Swi,?
4 Objective-C classes methods protocols categories functions ARC blocks Cocoa values & collections
5 Objective-C Swift classes methods protocols extensions functions ARC closures Cocoa values & collections
6 What's'a'bit$new'in'Swi,?
7 Objective-C Swift + Swift classes methods protocols extensions functions ARC closures Cocoa values & collections structs namespaces access control operator overloading ObjC interop Swift values & collections
8 What's'really&new'in'Swi,?
9 Objective-C Swift + Swift + Swift classes structs enums with associated values methods namespaces option types protocols access control pattern matching extensions operator generics functions overloading type inference ARC ObjC interop immutability supports closures Swift values & tuples Cocoa values collections & collections
10 Objective-C Swift + Swift + Swift classes structs enums with associated values methods namespaces option types protocols access control pattern matching extensions operator generics functions overloading type inference ARC ObjC interop immutability supports closures Swift values & tuples Cocoa values collections & collections
11 Every really new part of Swift originated in a functional programming language of the 1980s or earlier.
12 FP
13 JavaScript*is*brilliant*and*is* succeeding*...*and*i*think*it's*because* of*the*func:onal*stuff. "Douglas"Crockford,"2014
14 No#ma&er#what#language#you#work# in,#programming#in#a#func7onal#style# provides#benefits.#you#should#do#it# whenever#it#is#convenient... "John"Carmack,"2012.
15 a"programming"style trea%ng(the func%on as#the#primary#unit#of#abstrac2on
16 mathematical functions establish true relations computational functions do things which remain true t 0 =5 NSNumber * t0 f(t 0 ) = 50 NSNumber * pos = f(t0); pos; // => 50 f(t 0 ) = 50 pos = f(t0); pos; //=> 100; (surprise!)
17 mathematical variables are names we give to values computational variables are like names for places, whose contents can change t 0 =5 t 0 =5 t 0 =6 NSNumber * five five //?! five [five setintegervalue:8]; //?!?!
18 FP style boils down to Restrictions to emulate the predictability of mathematical functions and variables Idioms to use functions for all abstraction in defining other functions, in hiding information, etc. (Sometimes) type systems to provide compile-time checks on the values moving through functions
19 STYLE supported by FEATURES Restrictions pure functions immutable data purity and immutability guarantees Idioms combine, pass, & return functions like other values function literals function closures functions as first-class values enums (aka, sum types, tagged unions) Type systems (sometimes) to check valid values algebraic data types type inference fancy types: first-order, recursive, dependent, higher-kinded, constrained, etc..
20 dynamic Scheme (1975) static ML (1973) SML (1984) Erlang (1986) Haskell (1988) OCaml (1996) Scala (2003) Clojure (2009) F# (2005) Coq, Agda, Idris
21 So is Swift functional?
22 Haskell SML Scheme Clojure Swift ObjC purity & immutability help Yes, very. Y Y Y Y meh function literals, closures, first-classness Y Y Y Y Y meh expression-oriented Y Y Y Y N N proper tail calls Y Y Y N?? memory management Y Y Y Y meh meh generics Y Y N N Y N enum types Y Y N N Y N type inference Y Y N N Y N algebraic data types Y Y N N? N super DUPER fancy types Y? N N N N
23 If this were 1998 Swift would be a niche functional language
24 Swift is not functional June 10th, 2014 Rob Napier I, for one, welcome our new Haskell overloads Rob Napier Sep 29th, 2014
25 Objective-C without the C implies something subtractive, but Swift dramatically expands the design space through the introduction of generics and functional programming concepts. Chris Lattner
26 Should we care?
27
28 <opinion>value of FP</opinion> A useful toolbox for processing data, collections and streams. A salutary discipline for simplicity. Pure functions, plain values. When this is enough, it s also the best. And it s often enough. Enums & protocols interfaces clarify thinking, but types can complicate coding. (Safety benefits overrated.) FRP, ReactiveCocoa, functional GUI I remain hopeful, skeptical.
29 Objective-C Swift + Swift + Swift classes structs enums with associated values methods namespaces option types protocols access control pattern matching extensions operator generics functions overloading type inference ARC ObjC interop immutability supports closures Swift values & tuples Cocoa values collections & collections
30 Objective-C without the C implies something subtractive, but Swift dramatically expands the design space through the introduction of generics and functional programming concepts. Chris Lattner FP!= type systems
31
32
33
34 Where Swift/Cocoa fight FP Support for immutable values, but Inexpressive. Needs hash & equals boilerplate for value objects. Inexpressive. No support for updated copy of such value objects, nor of dictionaries, nor any KVC on structs. Unperformant? No functional data structures. Not expression-oriented. (e.g., switch returns no value) Cocoa is subclasserific.
35
36 Videos, notes, and exercises from the Coursera Programming Languages course, a great intro to Scheme, SML, and Ruby. < The talks by Rich Hickey (inventor of Clojure) are very rich: the Value of Values, the Language of the System, etc..
37 Chris Eidhof, Florian Kugler, and Wouter Swierstra Functional Programming in Swift GitHub RAC devs (jspahrsummers, joshaber, & others) ReactiveCocoa. This work is indirectly influenced by typed FP. < Maxwell Swadling SwiftZ. Currently translating lots of typed FP idioms into a Swift library. < David Nolen. Om. Functional approach to writing GUIs in the browser, using ClojureScript with Facebook s React, leveraging CSP-style concurrency. Untyped FP. <
38 @end
39 Is ObjC going away? Is it easier now?
40 Objective-C Swift + Swift + Swift classes structs enums with associated values methods namespaces option types protocols access control pattern matching extensions operator generics functions overloading type inference ARC ObjC interop immutability supports closures Swift values & tuples Cocoa values collections & collections
41 Objective-C isn't really going anywhere... Even if you start a brand new Swift app for the first time today after this session, you're going to use Cocoa, or Cocoa Touch. You're going to import Foundation. You're going to import UIKit. Those frameworks are written in Objective-C. That means, wherever you look around, there's going to be Objective-C in the picture. And you're going to have to deal with debugging mixed Swift / Objective-C situations.. "Advanced Swift Debugging in LLDB", WWDC2014, session 410, 20m 28m.
42 Canaries in the ObjC coal mine Swift achieves genuine C-like performance Swift-only types appearing at public API boundaries Deprecation of the ObjC runtime s more dynamic features
43 Swift is mostly conveniences Swift s support for FP are essentially conveniences vs ObjC: unified syntax for value types and references types, for methods, functions, and closures, type inference easier declarations of immutability More substantive: enums with associated values. Type system?
Functional Programming
The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@ifi.uio.no Department of informatics University of Oslo, Norway Motivation ML Demo Which programming languages are functional?
More informationSWIFT! init(title: String) { self.title = title } // required initializer w/ named parameter
SWIFT! class Session { let title: String // constant non-optional field: can never be null and can never be changed var instruktør: Person? // variable optional field: null is permitted var attendees:
More informationA Practical Optional Type System for Clojure. Ambrose Bonnaire-Sergeant
A Practical Optional Type System for Clojure Ambrose Bonnaire-Sergeant Statically typed vs. Dynamically typed Traditional distinction Dynamically typed Statically typed eg. Java, C, Haskell eg. Javascript,
More informationSoftware System Design and Implementation
Software System Design and Implementation Functional Programming Gabriele Keller The University of New South Wales School of Computer Science and Engineering Sydney, Australia COMP3141 16s1 Course software
More informationClosures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming
Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Summary 1. Predictive Parsing 2. Large Step Operational Semantics (Natural) 3. Small Step Operational Semantics
More informationFunctional Programming Patterns And Their Role Instructions
Functional Programming Patterns And Their Role Instructions In fact, the relabelling function is precisely the same as before! Phil Wadler's Chapter 7 of The Implementation of Functional Programming Languages.
More informationTHE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX
THE PRAGMATIC INTRO TO REACT Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX REACT "A JavaScript library for building user interfaces" But first... HOW WE GOT HERE OR: A BRIEF
More informationThe Hack programming language:
The Hack programming language: Types for PHP Andrew Kennedy Facebook Facebook s PHP Codebase 350,000 files >10,000,000 LoC (www.facebook.com & internally) 1000s of commits per day, 2 releases per day Anecdotally,
More informationFunctional Programming Lecture 13: FP in the Real World
Functional Programming Lecture 13: FP in the Real World Viliam Lisý Artificial Intelligence Center Department of Computer Science FEE, Czech Technical University in Prague viliam.lisy@fel.cvut.cz 1 Mixed
More informationXcode and Swift CS 4720 Mobile Application Development
Xcode and Swift Mobile Application Development Why Java for Android? Let s first recap: why do you think Android uses Java? 2 Why Java for Android? Some good reasons: You can t find a CS major that doesn
More informationLearning Scala: Practical Functional Programming For The JVM By Jason Swartz
Learning Scala: Practical Functional Programming For The JVM By Jason Swartz 20 Best Scala Books To Go From Beginner To Expert - WhatPixel - It offers OOP and functional programming and has tons of free
More informationCS457/557 Functional Languages
CS457/557 Functional Languages Spring 2018 Lecture 1: Course Introduction Andrew Tolmach Portland State University (with thanks to Mark P. Jones) 1 Goals of this course Introduce the beautiful ideas of
More informationCS 11 Haskell track: lecture 1
CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of
More informationSD314 Outils pour le Big Data
Institut Supérieur de l Aéronautique et de l Espace SD314 Outils pour le Big Data Functional programming in Python Christophe Garion DISC ISAE Christophe Garion SD314 Outils pour le Big Data 1/ 35 License
More informationHaskell in the Software Industry
Haskell in the Software Industry What is Haskell? Haskell in a nutshell Haskell is a pure, non-strict, statically typed, garbage collected, general purpose, functional programming language. Early history
More informationIntroduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)
Introduction to 3110 Prof. Clarkson Fall 2016 Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski) Welcome! Programming isn t hard Programming well is very hard
More informationJavaScript Fundamentals_
JavaScript Fundamentals_ HackerYou Course Syllabus CLASS 1 Intro to JavaScript Welcome to JavaScript Fundamentals! Today we ll go over what programming languages are, JavaScript syntax, variables, and
More informationSwift 5, ABI Stability and
Swift 5, ABI Stability and Concurrency @phillfarrugia Important Documents Concurrency Manifesto by Chris Lattner https: /gist.github.com/lattner/ 31ed37682ef1576b16bca1432ea9f782 Kicking off Concurrency
More informationType Inference. Prof. Clarkson Fall Today s music: Cool, Calm, and Collected by The Rolling Stones
Type Inference Prof. Clarkson Fall 2016 Today s music: Cool, Calm, and Collected by The Rolling Stones Review Previously in 3110: Interpreters: ASTs, evaluation, parsing Formal syntax Formal semantics
More informationSeminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh.
Scientific Computing Aachen, 6 Feb 2014 navid.abbaszadeh@rwth-aachen.de Overview Trends Introduction Paradigms, Data Structures, Syntax Compilation & Execution Concurrency Model Reference Types Performance
More informationCMSC 330: Organization of Programming Languages. Functional Programming with OCaml
CMSC 330: Organization of Programming Languages Functional Programming with OCaml 1 What is a functional language? A functional language: defines computations as mathematical functions discourages use
More informationIntroduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)
Introduction to 3110 Prof. Clarkson Fall 2018 Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski) Programming is not hard Programming well is very hard Folklore:
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More informationIntroduction to Nate Foster Spring 2018
Introduction to 3110 Nate Foster Spring 2018 Welcome! Programming isn t hard Programming well is very hard High variance among professionals productivity: 10x or more Studying functional programming will
More informationConcepts of programming languages
Concepts of programming languages Lecture 2 Wouter Swierstra 1 Last time: programming languages In the first lecture I tried to motivate why we might consider programming languages themselves as interesting
More informationFirst Programming Language in CS Education The Arguments for Scala
First Programming Language in CS Education The Arguments for Scala WORLDCOMP 2011 By Dr. Mark C. Lewis Trinity University Disclaimer I am writing a Scala textbook that is under contract with CRC Press.
More informationCSCI-GA Scripting Languages
CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation
More informationLecture 8: Summary of Haskell course + Type Level Programming
Lecture 8: Summary of Haskell course + Type Level Programming Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 31, 2017 Principles from Haskell
More informationXcode 6 and ios 8 What s New for Software Developers
Xcode 6 and ios 8 What s New for Software Developers August 2014 Norman McEntire! norman.mcentire@servin.com Slides and Video of this presentation will be posted on Tuesday Aug 26 here: http://servin.com!1
More informationRust for high level applications. Lise Henry
Rust for high level applications Lise Henry Who am I Elisabeth Henry A.k.a Lizzie Crowdagger Computer science background Semi-professional fantasy writer I like Rust, but not really into systems programming
More informationLecture 1: Overview
15-150 Lecture 1: Overview Lecture by Stefan Muller May 21, 2018 Welcome to 15-150! Today s lecture was an overview that showed the highlights of everything you re learning this semester, which also meant
More informationHaskell in the corporate environment. Jeff Polakow October 17, 2008
Haskell in the corporate environment Jeff Polakow October 17, 2008 Talk Overview Haskell and functional programming System description Haskell in the corporate environment Functional Programming in Industry
More informationTransitioning from C# to Scala Using Apache Thrift. Twitter Finagle
Transitioning from C# to Scala Using Apache Thrift and Twitter Finagle Steven Skelton September 19, 2013 Empathica Empathica provides Customer Experience Management programs to more than 200 of the world's
More informationCSC324 Principles of Programming Languages
CSC324 Principles of Programming Languages http://mcs.utm.utoronto.ca/~324 November 14, 2018 Today Final chapter of the course! Types and type systems Haskell s type system Types Terminology Type: set
More informationIntroduction to Functional Programming and Haskell. Aden Seaman
Introduction to Functional Programming and Haskell Aden Seaman Functional Programming Functional Programming First Class Functions Expressions (No Assignment) (Ideally) No Side Effects Different Approach
More informationFunctional Programming Principles in Scala. Martin Odersky
Functional Programming Principles in Scala Martin Odersky Programming Paradigms Paradigm: In science, a paradigm describes distinct concepts or thought patterns in some scientific discipline. Main programming
More informationClojureScript. as a compilation target to JS. Michiel Vijay FP AMS October 16th 2014
ClojureScript as a compilation target to JS Michiel Borkent @borkdude Vijay Kiran @vijaykiran FP AMS October 16th 2014 This work is licensed under a Creative Commons Attribution 4.0 International License.
More informationCSCI 2041: Introduction
CSCI 2041: Introduction Chris Kauffman Last Updated: Wed Sep 5 11:56:55 CDT 2018 1 Logistics Reading OCaml System Manual: 1.1-1.3 Practical OCaml: Ch 1-2 Goals History Tour of OCaml Language First Programs
More informationIntroduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)
Introduction to 3110 Prof. Clarkson Fall 2017 Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski) Welcome! Programming isn t hard Programming well is very hard
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques () Lecture 20 February 28, 2018 Transition to Java Announcements HW05: GUI programming Due: THURSDAY!! at 11:59:59pm Lots of TA office hours today Thursday See Piazza
More informationScala, Your Next Programming Language
Scala, Your Next Programming Language (or if it is good enough for Twitter, it is good enough for me) WORLDCOMP 2011 By Dr. Mark C. Lewis Trinity University Disclaimer I am writing a Scala textbook that
More informationClosures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming
Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming t ::= x x. t t t Call-by-value big-step Operational Semantics terms variable v ::= values abstraction x.
More informationRefactoring to Functional. Hadi Hariri
Refactoring to Functional Hadi Hariri Functional Programming In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs,
More informationBeyond JavaScript Frameworks: Writing Reliable Web Apps With. Elm. Erik Wendel DevDays Vilnius 2018
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm Erik Wendel DevDays Vilnius 2018 Who is Jonathan Ive? Erik Wendel JavaZone 2017 Elm is like Jonathan Ive would have designed a programming
More informationTopic 9: Type Checking
Recommended Exercises and Readings Topic 9: Type Checking From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6 and
More informationTopic 9: Type Checking
Topic 9: Type Checking 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6
More informationTopics Covered Thus Far CMSC 330: Organization of Programming Languages
Topics Covered Thus Far CMSC 330: Organization of Programming Languages Names & Binding, Type Systems Programming languages Ruby Ocaml Lambda calculus Syntax specification Regular expressions Context free
More informationProgramming Paradigms
PP 2017/18 Unit 18 Summary of Basic Concepts 1/13 Programming Paradigms Unit 18 Summary of Basic Concepts J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE PP 2017/18 Unit 18
More informationDESIGN, EVOLUTION AND USE
DESIGN, EVOLUTION AND USE of KernelF voelter@acm.org www.voelter.de @markusvoelter Markus Völter Check out the paper! http://voelter.de/data /pub/kernelf-icmt.pdf EXAMPLE 1 Healthcare 1 Context Mobile
More informationObject-Oriented Programming in Objective-C
In order to build the powerful, complex, and attractive apps that people want today, you need more complex tools than a keyboard and an empty file. In this section, you visit some of the concepts behind
More informationIntroduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)
Introduction to 3110 Prof. Clarkson Fall 2015 Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski) Welcome! Programming isn t hard Programming well is very hard
More informationFunctional Programming and the Web
June 13, 2011 About Me Undergraduate: University of Illinois at Champaign-Urbana PhD: Penn State University Retrofitting Programs for Complete Security Mediation Static analysis, type-based compiler Racker:
More informationFunctional Reactive Programming on ios
Functional Reactive Programming on ios Functional reactive programming introduction using ReactiveCocoa Ash Furrow This book is for sale at http://leanpub.com/iosfrp This version was published on 2016-05-28
More informationCS-XXX: Graduate Programming Languages. Lecture 22 Class-Based Object-Oriented Programming. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 22 Class-Based Object-Oriented Programming Dan Grossman 2012 PL Issues for OOP? OOP lets you: 1. Build some extensible software concisely 2. Exploit an intuitive
More informationConcepts of Programming Languages
Concepts of Programming Languages Lecture 15 - Functional Programming Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages
More informationRichard Mallion. Swift for Admins #TEAMSWIFT
Richard Mallion Swift for Admins #TEAMSWIFT Apple Introduces Swift At the WWDC 2014 Keynote, Apple introduced Swift A new modern programming language It targets the frameworks for Cocoa and Cocoa Touch
More informationCS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013
CS252 Advanced Programming Language Principles Prof. Tom Austin San José State University Fall 2013 What are some programming languages? Why are there so many? Different domains Mobile devices (Objective
More informationTradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?
Tradeoffs CSE 505: Programming Languages Lecture 15 Subtyping Zach Tatlock Autumn 2017 Desirable type system properties (desiderata): soundness - exclude all programs that get stuck completeness - include
More informationOrganization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?
Organization of Programming Languages (CSE452) Instructor: Dr. B. Cheng Fall 2004 1 Why are there so many programming languages? Evolution -- we've learned better ways of doing things over time Socio-economic
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2018 Lecture 7b Andrew Tolmach Portland State University 1994-2018 Dynamic Type Checking Static type checking offers the great advantage of catching errors early And
More informationCSE341: Programming Languages Interlude: Course Motivation. Zach Tatlock Winter 2018
CSE341: Programming Languages Interlude: Course Motivation Zach Tatlock Winter 2018 Course Motivation (Did you think I forgot? J) Why learn the fundamental concepts that appear in all (most?) languages?
More informationCSE 333 Lecture 1 - Systems programming
CSE 333 Lecture 1 - Systems programming Hal Perkins Department of Computer Science & Engineering University of Washington Welcome! Today s goals: - introductions - big picture - course syllabus - setting
More information(Refer Slide Time: 4:00)
Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional
More informationFront-end Technologies for Formal-Methods Tools
Front-end Technologies for Formal-Methods Tools Makarius Wenzel Univ. Paris-Sud, Laboratoire LRI November 2013 Abstract Looking at the past decades of interactive (and automated) theorem proving, and tools
More informationPushing the Limits. ios 6 Programming TOUCH ADVANCED APPLICATION DEVELOPMENT FOR APPLE IPHONE, IPAD, AND IPOD WILEY. Rob Napier and Mugunth Kumar
ios 6 Programming Pushing the Limits ADVANCED APPLICATION DEVELOPMENT FOR APPLE IPHONE, IPAD, AND IPOD TOUCH Rob Napier and Mugunth Kumar WILEY A John Wiley and Sons, Ltd, Publication Introduction 1 Who
More informationCSCE 314 Programming Languages
CSCE 314 Programming Languages Haskell 101 Dr. Hyunyoung Lee 1 Contents 1. Historical Background of Haskell 2. Lazy, Pure, and Functional Language 3. Using ghc and ghci 4. Functions 5. Haskell Scripts
More informationData Types. Every program uses data, either explicitly or implicitly to arrive at a result.
Every program uses data, either explicitly or implicitly to arrive at a result. Data in a program is collected into data structures, and is manipulated by algorithms. Algorithms + Data Structures = Programs
More informationOverview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory
SCRIPTING Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Reflection Bindings Serialization Performance, memory Rationale C++ isn't the best choice
More informationCS162 Week 1. Kyle Dewey. Friday, January 10, 14
CS162 Week 1 Kyle Dewey Overview Basic Introduction CS Accounts Scala survival guide Office Hour Choose an hour from within: Tuesday/Thursday 11 AM - 1 PM Friday 11 AM - 4 PM Also available by appointment
More informationMulti-catch. Future Features. Sometimes we need to handle more than one exception in a single catch block:
1 Multi-catch Sometimes we need to handle more than one exception in a single catch block: try { // some code } catch (e: ExceptionA ExceptionB) { log(e); throw e; } Note that this is not proposing general
More informationConcepts of programming languages
Concepts of programming languages Something El(m)se Paolo Servillo, Enzo van Kessel, Jesse de Ruijter 1 Contents What is Elm? The language The architecture Transcompiling Elm in practice 2 What is Elm?
More informationCMPSC 311- Introduction to Systems Programming Module: Systems Programming
CMPSC 311- Introduction to Systems Programming Module: Systems Programming Professor Patrick McDaniel Fall 2015 WARNING Warning: for those not in the class, there is an unusually large number of people
More informationScope. Chapter Ten Modern Programming Languages 1
Scope Chapter Ten Modern Programming Languages 1 Reusing Names Scope is trivial if you have a unique name for everything: fun square a = a * a; fun double b = b + b; But in modern languages, we often use
More informationBE PROACTIVE USE REACTIVE
BE PROACTIVE USE REACTIVE This morning we re going to talk about reactive programming. We ll cover some of the what, why, and how, hopefully with a bend towards grasping the fundamentals. We ll have some
More informationProgramming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,
More informationCSE 333 Lecture 1 - Systems programming
CSE 333 Lecture 1 - Systems programming Steve Gribble Department of Computer Science & Engineering University of Washington Welcome! Today s goals: - introductions - big picture - course syllabus - setting
More informationWriting Cognitive Swift Apps developerworks Open Tech Talk March 8, 2017
Writing Cognitive Swift Apps developerworks Open Tech Talk March 8, 2017 https://developer.ibm.com/open/videos/writing-cognitive-swift-apps-tech-talk/ Question Can you please also compare Swift and Go?
More informationITT8060 Advanced Programming
ITT8060 Advanced Programming In F# Juhan Ernits Welcome to Advanced Programming (in F#)! Teachers: Juhan Ernits Hendrik Maarand Course web page http://courses.cs.ttu.ee/pages/itt8060 Contact: juhan.ernits@ttu.ee
More informationConcurrency: what, why, how
Concurrency: what, why, how May 28, 2009 1 / 33 Lecture about everything and nothing Explain basic idea (pseudo) vs. Give reasons for using Present briefly different classifications approaches models and
More informationSoftware Design and Analysis for Engineers
Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 1 Date:
More informationTo figure this out we need a more precise understanding of how ML works
Announcements: What are the following numbers: 74/2/70/17 (2:30,2:30,3:35,7:30) PS2 due Thursday 9/20 11:59PM Guest lecture on Tuesday 9/25 o No RDZ office hours next Friday, I am on travel A brief comment
More informationCS153: Compilers Lecture 1: Introduction
CS153: Compilers Lecture 1: Introduction Stephen Chong https://www.seas.harvard.edu/courses/cs153 Source Code What is this course about?? Compiler! Target Code 2 What is this course about? How are programs
More informationOverloading, Type Classes, and Algebraic Datatypes
Overloading, Type Classes, and Algebraic Datatypes Delivered by Michael Pellauer Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. September 28, 2006 September 28, 2006 http://www.csg.csail.mit.edu/6.827
More informationIntroduction, Functions
Informatics 1 Functional Programming Lectures 1 and 2 Introduction, Functions Don Sannella University of Edinburgh Welcome to Informatics 1, Functional Programming! Informatics 1 course organiser: Paul
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Type Inference Some statically typed languages, like ML (and to a lesser extent Scala), offer alternative
More informationParadigms of computer programming
Paradigms of computer programming Louv1.1x and Louv1.2x form a two-course sequence Together they teach programming as a unified discipline that covers all programming languages Second-year university level:
More informationCIS 194: Homework 4. Due Wednesday, February 18, What is a Number?
CIS 194: Homework 4 Due Wednesday, February 18, 2015 What is a Number? This may sound like a deep, philosophical question, but the Haskell type system gives us a simple way to answer it. A number is any
More informationIA010: Principles of Programming Languages
IA010: Principles of Programming Languages Introduction and course organization Achim Blumensath blumens@fi.muni.cz Faculty of Informatics, Masaryk University, Brno Warm-up: A Quiz What does this program
More informationCSE 341: Programming Languages
CSE 341: Programming Languages Hal Perkins Spring 2011 Lecture 19 Introduction to Ruby Hal Perkins CSE341 Spring 2011, Lecture 19 1 Today Why Ruby? Some basics of Ruby programs Syntax Classes, Methods
More informationTYPE INFERENCE. François Pottier. The Programming Languages Mentoring ICFP August 30, 2015
TYPE INFERENCE François Pottier The Programming Languages Mentoring Workshop @ ICFP August 30, 2015 What is type inference? What is the type of this OCaml function? let f verbose msg = if verbose then
More informationIt's Time To Get Functional 이건희
It's Time To Get Functional 20071032 이건희 1 Context Intro Performance Popularity Network Effect Why Is It Time To Get Functional? 2 Intro 3 Architect You are the architect (or carpenter). 4 Tools Can you
More informationMF#K - Introduction to F# GroupM Mødegruppe for Ƒunktionelle Københavnere (MF#K)
MF#K - Introduction to F# meeting @ GroupM 2015-07-08 Mødegruppe for Ƒunktionelle Københavnere (MF#K) Overview About me Matching of expectations Agenda 15:30 > Short introduction to F# (sales pitch) 15:50
More informationData Types primitive, arrays, objects Java overview Primitive data types in Java
Data Types primitive, arrays, objects Java overview Primitive data types in Java 46 Recap Day 2! Lessons Learned:! Sample run vs. pseudocode! Java program structure: set-up, then real statements, decent
More informationWho am I? Harlan Iverson. Programming enthusiast. Seeker of truth. Imperfect. I'll be wrong about some things. Please correct me if you can.
Who am I? Harlan Iverson. Programming enthusiast. Seeker of truth. Imperfect. I'll be wrong about some things. Please correct me if you can. P.S... I hate boring presentations. Please, engage and stay
More informationFunctional Programming Lecture 1: Introduction
Functional Programming Lecture 1: Introduction Viliam Lisý Artificial Intelligence Center Department of Computer Science FEE, Czech Technical University in Prague viliam.lisy@fel.cvut.cz Acknowledgements
More informationA Func'onal Introduc'on. COS 326 David Walker Princeton University
A Func'onal Introduc'on COS 326 David Walker Princeton University Thinking Func'onally In Java or C, you get (most) work done by changing something temp = pair.x; pair.x = pair.y; pair.y = temp; commands
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 10 February 5 th, 2016 Abstract types: sets Lecture notes: Chapter 10 What is the value of this expresssion? let f (x:bool) (y:int) : int = if x then
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Type Systems, Names and Binding CMSC 330 - Spring 2013 1 Topics Covered Thus Far! Programming languages Ruby OCaml! Syntax specification Regular expressions
More informationPrinciples of Programming Languages
Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Collaboration and Management Dana Fisman Lesson 5 - Data Types and Operations on Data 1 Types - what we already know Types define sets of values
More informationThe Haskell HOP: Higher-order Programming
The Haskell HOP: Higher-order Programming COS 441 Slides 6 Slide content credits: Ranjit Jhala, UCSD Agenda Haskell so far: First-order functions This time: Higher-order functions: Functions as data, arguments
More information