Data Structures in Functional Languages
|
|
- Laurence Bates
- 5 years ago
- Views:
Transcription
1 Data Structures in Functional Languages Performance Better than log Binary trees provide lg n performance B-trees provide log t n performance Can the performance be better than that? High branching factor can give you better performance (B-trees have this) 2
2 Tries (not Trees) Tries have a very high branching factor (32 or more) Use a special property to organize the keys Keys at each level differ by one bit Only when there is a collision you move to next level The location of the key is determined by its path (nodes don t store keys, their position is their key) Performance still log 32 n which is not really constant, but close to constant for reasonable values 3 Tries
3 Tries Another way to look at this a i f m n a i f m t s n m e an it is in im me 5 Immutability Functional programming style promotes immutability Objects can t be modified once you create them This helps preserve referential integrity (easy to prove correctness and to move around computations) This in turn favors concurrency 6
4 Collections and Immutability Collections hold several objects Mutable collections provide fairly good performance but suffer greatly when it comes to concurrency If you make a data structure immutable, you then have no issue of concurrency, but... If you re not careful, it can suffer from copy-overhead performance when you want to make changes 7 Persistent Data Structures Name is misleading Persistent here does not mean stored on disk Persistence here means preserves its contents when changed, meaning it does not change and you can make copies of it when you need to change The immutability promote sharing among instances of data structures Does not make full copy, so preserves performance for most part 8
5 Let s Explore Persistent DS Traditional arrays are not immutable array[i] = 4 They are not persistent, either How to insert and element? shift all elements before the insertion point to right and then insert, not very efficient You can make a copy, still the same efficiency (or lack of) 9 List Creation How do you create a list of 1, 2, 3? List(1, List(2, List(3, EMPTY))) 10
6 Consider an Immutable List list1 You want to prefix an element to the list1 list2 = elem :: list1 But how to do this efficiently? list2 This is why lists in functional languages often allow operations around the head and tail (rest) 11 Erlang List Access #!/usr/bin/env escript main(_) -> io:format("~p", [max([1, 2, 5, 7, 2, 4, 2, 1])]). max([h []]) -> H; max([h T]) -> max2(h, max(t)). max2(a, B) when A > B -> A; max2(_, B) -> B. 12
7 Erlang Creating a List #!/usr/bin/env escript main(_) -> List = [1, 2, 7, 8, 9, 2, 4, 6], {Even, Odd} = get_even_odd(list, [], []), io:format("~p\n", [Even]), io:format("~p", [Odd]). get_even_odd([h T], Even, Odd) -> case (H rem 2) of 1 -> get_even_odd(t, Even, [H Odd]); 0 -> get_even_odd(t, [H Even], Odd) end; get_even_odd([], Even, Odd) -> {Even, Odd}. 13 List Comprehension #!/usr/bin/env escript main(_) -> List = [5, 2, 9, 1, 5, 4, 3], SortedList = sort(list), io:format("~p\n", [SortedList]). sort([h T]) -> sort([x X <- T, X < H]) ++ [H] ++ sort([x X <- T, X >= H]); 14
8 Creating List in Scala val list1 = List(1, 2, 3) println(list1) val list2 = 0 :: list1 println(list2) val list3 = list1 ::: List(4) println(list3) 15 Scala Splitting List val list1 = List(1, 2, 3, 4) println(list1.head) println(list1.tail) println(list1(3)) list1 match { } case head :: tail => println(head) println(tail) case _ => println("empty") 16
9 List Concatenation list1 list2 list3 17 What about a Tree? 1 t2 t How to insert 8 below 4? By selective copying 18
10 Lazy Sequence A Lazy sequence is a sequence in which elements are not added until really needed You can easily postpone computations that may not be needed You can work with huge data structures that may not fit into the memory all at one time Clojure readily supports this 19 Lazy Infinite Sequence (defn integers ([] (concat [0] (integers 1))) ([n] (lazy-seq (cons n (integers (+ n 1)))))) (println (take 10 (integers))) 20
11 Finding factorial for n terms (defn fact ([] (concat [1] (fact 1 2))) ([p n] (let [prod (* p n)] (let [nextvalue (+ n 1)] (lazy-seq (cons prod (fact prod nextvalue))))))) (println (take 10 (fact))) 21 References Making Data Structures Persistent: Rich Hickey - creator of Clojure has an excellent presentation, a must view: Rich Hickey on Persistent Data Structures and Managed Reference: Identity-State-Rich-Hickey Programming Clojure, Stuart Halloway, Pragmatic Programmers,
CPL 2016, week 10. Clojure functional core. Oleg Batrashev. April 11, Institute of Computer Science, Tartu, Estonia
CPL 2016, week 10 Clojure functional core Oleg Batrashev Institute of Computer Science, Tartu, Estonia April 11, 2016 Overview Today Clojure language core Next weeks Immutable data structures Clojure simple
More informationIntroduction Basics Concurrency Conclusion. Clojure. Marcel Klinzing. December 13, M. Klinzing Clojure 1/18
Clojure Marcel Klinzing December 13, 2012 M. Klinzing Clojure 1/18 Overview/History Functional programming language Lisp dialect Compiles to Java Bytecode Implemented in Java Created by Rich Hickey Version
More informationClojure is. A dynamic, LISP-based. programming language. running on the JVM
(first '(Clojure.)) Clojure is A dynamic, LISP-based programming language running on the JVM Origin 2007, Rich Hickey.. 1958, John McCarthy Features Functional Homoiconic Immutability (persistent data
More informationUsing Scala in CS241
Using Scala in CS241 Winter 2018 Contents 1 Purpose 1 2 Scala 1 3 Basic Syntax 2 4 Tuples, Arrays, Lists and Vectors in Scala 3 5 Binary output in Scala 5 6 Maps 5 7 Option types 5 8 Objects and Classes
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 informationImplementing Coroutines with call/cc. Producer/Consumer using Coroutines
Implementing Coroutines with call/cc Producer/Consumer using Coroutines Coroutines are a very handy generalization of subroutines. A coroutine may suspend its execution and later resume from the point
More informationDeclarative concurrency. March 3, 2014
March 3, 2014 (DP) what is declarativeness lists, trees iterative comutation recursive computation (DC) DP and DC in Haskell and other languages 2 / 32 Some quotes What is declarativeness? ness is important
More informationShell CSCE 314 TAMU. Functions continued
1 CSCE 314: Programming Languages Dr. Dylan Shell Functions continued 2 Outline Defining Functions List Comprehensions Recursion 3 A Function without Recursion Many functions can naturally be defined in
More informationMUTABLE LISTS AND DICTIONARIES 4
MUTABLE LISTS AND DICTIONARIES 4 COMPUTER SCIENCE 61A Sept. 24, 2012 1 Lists Lists are similar to tuples: the order of the data matters, their indices start at 0. The big difference is that lists are mutable
More informationClojure. A (not-so-pure) functional approach to concurrency. Paolo Baldan Linguaggi per il Global Computing AA 2016/2017
Clojure A (not-so-pure) functional approach to concurrency Paolo Baldan Linguaggi per il Global Computing AA 2016/2017 In the words of the inventor Functional programming (rooted in Lisp, from 60s old
More informationRobot Programming with Lisp
4. Functional Programming: Higher-order Functions, Map/Reduce, Lexical Scope Institute for Artificial University of Bremen 9 of November, 2017 Functional Programming Pure functional programming concepts
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 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 informationReading Assignment. Lazy Evaluation
Reading Assignment Lazy Evaluation MULTILISP: a language for concurrent symbolic computation, by Robert H. Halstead (linked from class web page Lazy evaluation is sometimes called call by need. We do an
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing
More informationSCHEME 10 COMPUTER SCIENCE 61A. July 26, Warm Up: Conditional Expressions. 1. What does Scheme print? scm> (if (or #t (/ 1 0)) 1 (/ 1 0))
SCHEME 0 COMPUTER SCIENCE 6A July 26, 206 0. Warm Up: Conditional Expressions. What does Scheme print? scm> (if (or #t (/ 0 (/ 0 scm> (if (> 4 3 (+ 2 3 4 (+ 3 4 (* 3 2 scm> ((if (< 4 3 + - 4 00 scm> (if
More informationPROGRAMMING IN HASKELL. CS Chapter 6 - Recursive Functions
PROGRAMMING IN HASKELL CS-205 - Chapter 6 - Recursive Functions 0 Introduction As we have seen, many functions can naturally be defined in terms of other functions. factorial :: Int Int factorial n product
More informationProgramming Paradigms
PP 2017/18 Unit 11 Functional Programming with Haskell 1/37 Programming Paradigms Unit 11 Functional Programming with Haskell J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE
More informationHaskell: From Basic to Advanced. Part 2 Type Classes, Laziness, IO, Modules
Haskell: From Basic to Advanced Part 2 Type Classes, Laziness, IO, Modules Qualified types In the types schemes we have seen, the type variables were universally quantified, e.g. ++ :: [a] -> [a] -> [a]
More informationPERSISTENT SEQUENCES WITH EFFECTIVE RANDOM ACCESS AND SUPPORT FOR INFINITY
JACSM 2014, Vol. 6, No. 1, pp. 67-80 DOI 10.2478/jacsm-2014-0005 PERSISTENT SEQUENCES WITH EFFECTIVE RANDOM ACCESS AND SUPPORT FOR INFINITY Konrad Grzanek IT Institute, University of Social Sciences, Łódź,
More informationProgramming Clojure, Third Edition
Extracted from: Programming Clojure, Third Edition This PDF file contains pages extracted from Programming Clojure, Third Edition, published by the Pragmatic Bookshelf. For more information or to purchase
More informationLazy Evaluation in Scala
Lazy Evaluation Lazy Evaluation The proposed implementation suffers from a serious potential performance problem: If tail is called several times, the corresponding stream will be recomputed each time.
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 informationAll you need is fun. Cons T Åhs Keeper of The Code
All you need is fun Cons T Åhs Keeper of The Code cons@klarna.com Cons T Åhs Keeper of The Code at klarna Architecture - The Big Picture Development - getting ideas to work Code Quality - care about the
More informationClojure Concurrency Constructs. CSCI 5828: Foundations of Software Engineering Lecture 12 10/02/2014
Clojure Concurrency Constructs CSCI 5828: Foundations of Software Engineering Lecture 12 10/02/2014 1 Goals Cover the material presented in Chapters 3 & 4 of our concurrency textbook! Books examples from
More informationIntroduction to Haskell
Introduction to Haskell Matt Mullins Texas A&M Computing Society October 6, 2009 Matt Mullins (TACS) Introduction to Haskell October 6, 2009 1 / 39 Outline Introduction to Haskell Functional Programming
More informationINTRODUCTION TO HASKELL
INTRODUCTION TO HASKELL PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/81 HASKELL: A PURELY FUNCTIONAL PROGRAMMING LANGUAGE Functions are first-class values: Can be
More informationPOETRY OF PROGRAMMING CODE READING EXERCISES IN CLOJURE V
POETRY OF PROGRAMMING CODE READING EXERCISES IN CLOJURE V2018.6.6 Contents 1. Introduction 1 1.1. Why do we need to read code? 1 1.2. Instructions 2 1.3. Recommended method 2 2. Function composition first
More informationIntroduction to Clojure Concurrency (and data structures)
Introduction to Clojure Concurrency (and data structures) Karl Krukow, Engineer at Trifork & CTO LessPainful @karlkrukow Goto Amsterdam, May 2012 Introduction to Clojure Concurrency (and data structures)
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 informationStop coding Pascal. Saturday, April 6, 13
Stop coding Pascal...emotional sketch about past, present and future of programming languages, Python, compilers, developers, Life, Universe and Everything Alexey Kachayev CTO at KitApps Inc. Open source
More informationLECTURE 16. Functional Programming
LECTURE 16 Functional Programming WHAT IS FUNCTIONAL PROGRAMMING? Functional programming defines the outputs of a program as a mathematical function of the inputs. Functional programming is a declarative
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 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 informationLab 9: More Sorting Algorithms 12:00 PM, Mar 21, 2018
CS18 Integrated Introduction to Computer Science Fisler, Nelson Lab 9: More Sorting Algorithms 12:00 PM, Mar 21, 2018 Contents 1 Heapsort 2 2 Quicksort 2 3 Bubble Sort 3 4 Merge Sort 3 5 Mirror Mirror
More informationClojure for OOP folks Stefan innoq
Clojure for OOP folks Stefan Tilkov @stilkov innoq 1 Motivation 2 Syntax Idioms 3 OOP Thinking model domains with classes & interfaces encapsulate data in objects prefer specific over generic solutions
More informationThe Curious Clojureist
The Curious Clojureist NEAL FORD director / software architect meme wrangler ThoughtWorks nford@thoughtworks.com 2002 Summit Boulevard, Atlanta, GA 30319 nealford.com thoughtworks.com memeagora.blogspot.com
More information! Addition! Multiplication! Bigger Example - RSA cryptography
! Addition! Multiplication! Bigger Example - RSA cryptography Modular Arithmetic Modular Exponentiation Primality Testing (Fermat s little theorem) Probabilistic algorithm Euclid s Algorithm for gcd (greatest
More informationLecture #11: Immutable and Mutable Data. Last modified: Sun Feb 19 17:03: CS61A: Lecture #11 1
Lecture #11: Immutable and Mutable Data Last modified: Sun Feb 19 17:03:49 2017 CS61A: Lecture #11 1 Building Recursive Structures In Lecture #9, we defined map rlist and filter rlist: def map rlist(f,
More informationFunctional Data Structures for Typed Racket. Hari Prashanth and Sam Tobin-Hochstadt Northeastern University
Functional Data Structures for Typed Racket Hari Prashanth and Sam Tobin-Hochstadt Northeastern University 1 Motivation Typed Racket has very few data structures 2 Motivation Typed Racket has very few
More informationProgramming Systems in Artificial Intelligence Functional Programming
Click to add Text Programming Systems in Artificial Intelligence Functional Programming Siegfried Nijssen 8/03/16 Discover thediscover world at the Leiden world University at Leiden University Overview
More informationFunctional programming
Functional programming Functional programming In functional programming, functions are the core building blocks In pure functional programming, functions are like mathematical functions Mathematical functions
More informationMotivation for B-Trees
1 Motivation for Assume that we use an AVL tree to store about 20 million records We end up with a very deep binary tree with lots of different disk accesses; log2 20,000,000 is about 24, so this takes
More informationDatatype declarations
Datatype declarations datatype suit = HEARTS DIAMONDS CLUBS SPADES datatype a list = nil (* copy me NOT! *) op :: of a * a list datatype a heap = EHEAP HEAP of a * a heap * a heap type suit val HEARTS
More informationFall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives
CS 6A Scheme Fall 207 Discussion 7: October 25, 207 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write
More informationClojure Lisp for the Real #clojure
Clojure Lisp for the Real World @stuartsierra #clojure 1 Bullet Points Values Code is data Generic data access Concurrency 2 Stuart Sierra Relevance, Inc. Clojure/core Clojure contributor 3 Values 4 Values
More informationHashing Techniques. Material based on slides by George Bebis
Hashing Techniques Material based on slides by George Bebis https://www.cse.unr.edu/~bebis/cs477/lect/hashing.ppt The Search Problem Find items with keys matching a given search key Given an array A, containing
More informationExecutive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads.
Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads. Poor co-ordination that exists in threads on JVM is bottleneck
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 informationShared state model. April 3, / 29
Shared state April 3, 2012 1 / 29 the s s limitations of explicit state: cells equivalence of the two s programming in limiting interleavings locks, monitors, transactions comparing the 3 s 2 / 29 Message
More informationHaskell: Lists. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, February 24, Glenn G.
Haskell: Lists CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, February 24, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts
More informationFunctional 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 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 information.consulting.solutions.partnership. Clojure by Example. A practical introduction to Clojure on the JVM
.consulting.solutions.partnership Clojure by Example A practical introduction to Clojure on the JVM Clojure By Example 1 Functional Progamming Concepts 3 2 Clojure Basics 4 3 Clojure Examples 5 4 References
More informationIt is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis
Chapter 14 Functional Programming Programming Languages 2nd edition Tucker and Noonan It is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis
More informationClassical Themes of Computer Science
Functional Programming (Part 1/2) Bernhard K. Aichernig Institute for Software Technology Graz University of Technology Austria Winter Term 2017/18 Version: November 22, 2017 1/49 Agenda I Functional Programming?
More informationIntroduction to Logic Programming. Ambrose
Introduction to Logic Programming Ambrose Bonnaire-Sergeant @ambrosebs abonnairesergeant@gmail.com Introduction to Logic Programming Fundamental Logic Programming concepts Related to FP General implementation
More informationStuart
Clojure Time Stuart Halloway stu@clojure.com @stuarthalloway Copyright 2007-2010 Relevance, Inc. This presentation is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United
More informationOption Values, Arrays, Sequences, and Lazy Evaluation
Option Values, Arrays, Sequences, and Lazy Evaluation Björn Lisper School of Innovation, Design, and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ Option Values, Arrays,
More informationFall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives
CS 6A Scheme Fall 208 Discussion 8: October 24, 208 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write
More informationSymbols. abstractions, implementing, 270 through indirection, 77 with macros, 183 abstract syntax tree (AST), 149
Index Symbols + (addition operator), 36 37 @, 155, 197 >!! (blocking put), 235 238
More informationScala Concurrency and Parallel Collections
Scala Concurrency and Parallel Collections Concurrent Programming Keijo Heljanko Department of Computer Science University School of Science November 23rd, 2016 Slides by Keijo Heljanko Scala Scala Originally
More informationclojure & cfml sitting in a tree sean corfield world singles
clojure & cfml sitting in a tree sean corfield world singles 1 how to go faster (with (parentheses)) sean corfield world singles 2 world singles 3 world singles founded in 2001 internet dating platform
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 informationDRAFT. Master Thesis. Turning Relaxed Radix Balanced Vector from Theory into Practice for Scala Collections. Supervisor: Nicolas Stucki
Master Thesis Turning Relaxed Radix Balanced Vector from Theory into Practice for Scala Collections Author: Supervisor: Nicolas Stucki Martin Odersky A thesis submitted in fulfilment of the requirements
More informationCS 842 Ben Cassell University of Waterloo
CS 842 Ben Cassell University of Waterloo Recursive Descent Re-Cap Top-down parser. Works down parse tree using the formal grammar. Built from mutually recursive procedures. Typically these procedures
More informationPractically Functional. Daniel Spiewak
Practically Functional Daniel Spiewak whoami Author of Scala for Java Refugees and other articles on Scala and FP Former editor Javalobby / EclipseZone Engaged in academic research involving Scala DSLs
More informationCSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions
1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions
More informationChapter 15. Functional Programming Languages
Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages
More informationA brief tour of history
Introducing Racket λ A brief tour of history We wanted a language that allowed symbolic manipulation Scheme The key to understanding LISP is understanding S-Expressions Racket List of either atoms or
More informationSummer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define
CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,
More informationCS127: B-Trees. B-Trees
CS127: B-Trees B-Trees 1 Data Layout on Disk Track: one ring Sector: one pie-shaped piece. Block: intersection of a track and a sector. Disk Based Dictionary Structures Use a disk-based method when the
More informationCS450 - Structure of Higher Level Languages
Spring 2018 Streams February 24, 2018 Introduction Streams are abstract sequences. They are potentially infinite we will see that their most interesting and powerful uses come in handling infinite sequences.
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 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 informationCS205: Scalable Software Systems
CS205: Scalable Software Systems Lecture 3 September 5, 2016 Lecture 3 CS205: Scalable Software Systems September 5, 2016 1 / 19 Table of contents 1 Quick Recap 2 Type of recursive solutions 3 Translating
More informationCPS 506 Comparative Programming Languages. Programming Language Paradigm
CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming
More informationTackling Concurrency With STM. Mark Volkmann 10/22/09
Tackling Concurrency With Mark Volkmann mark@ociweb.com 10/22/09 Two Flavors of Concurrency Divide and conquer divide data into subsets and process it by running the same code on each subset concurrently
More informationTackling Concurrency With STM
Tackling Concurrency With Mark Volkmann mark@ociweb.com 10/22/09 Two Flavors of Concurrency Divide and conquer divide data into subsets and process it by running the same code on each subset concurrently
More informationHow functional programming made me a better OO developer
How functional programming made me a better OO developer Jessica Kerr @jessitron developer s creed I am more than an Object-Oriented Developer. I am a solver of problems, a creator of solutions. What do
More informationIntro to Haskell Notes: Part 1
Intro to Haskell Notes: Part 1 Adrian Brasoveanu July 1, 2013 Contents 1 Comments 2 2 Simple arithmetic 2 3 Boolean operators 2 4 Testing for equality 3 5 No covert type conversion 3 6 Functions 4 6.1
More informationWhat is a Multi-way tree?
B-Tree Motivation for studying Multi-way and B-trees A disk access is very expensive compared to a typical computer instruction (mechanical limitations) -One disk access is worth about 200,000 instructions.
More informationCS 2340 Objects and Design - Scala
CS 2340 Objects and Design - Scala Objects and Operators Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 2340 Objects and Design - Scala Objects and Operators 1 / 13 Classes
More informationChapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes
Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,
More informationStreams. CS21b: Structure and Interpretation of Computer Programs Spring Term, 2004
Streams CS21b: Structure and Interpretation of Computer Programs Spring Term, 2004 We ve already seen how evaluation order can change behavior when we program with state. Now we want to investigate how
More informationChapter 15. Functional Programming Languages
Chapter 15 Functional Programming Languages Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming Language: Lisp Introduction
More informationCOSE212: Programming Languages. Lecture 4 Recursive and Higher-Order Programming
COSE212: Programming Languages Lecture 4 Recursive and Higher-Order Programming Hakjoo Oh 2016 Fall Hakjoo Oh COSE212 2016 Fall, Lecture 4 September 27, 2016 1 / 21 Recursive and Higher-Order Programming
More informationSCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017
SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,
More informationOptimizing Hash-tries for Fast and Lean Immutable Collection Libraries
SWAT - Software Analysis And Transformation Optimizing Hash-tries for Fast and Lean Immutable Collection Libraries IFIP WG 2.4 Software Implementation Technology Stellenbosch, November 2014 Michael Steindorfer
More informationClojure. A Dynamic Programming Language for the JVM. Rich Hickey
Clojure A Dynamic Programming Language for the JVM Rich Hickey Clojure Fundamentals 3 years in development, released 10/2007 A new Lisp, not Common Lisp or Scheme Functional emphasis on immutability Supporting
More informationCS 106B Lecture 26: Esoteric Data Structures: Skip Lists and Bloom Filters
CS 106B Lecture 26: Esoteric Data Structures: Skip Lists and Bloom Filters Monday, August 14, 2017 Programming Abstractions Summer 2017 Stanford University Computer Science Department Lecturer: Chris Gregg
More informationSubclassing for ADTs Implementation
Object-Oriented Design Lecture 8 CS 3500 Fall 2009 (Pucella) Tuesday, Oct 6, 2009 Subclassing for ADTs Implementation An interesting use of subclassing is to implement some forms of ADTs more cleanly,
More informationn n Try tutorial on front page to get started! n spring13/ n Stack Overflow!
Announcements n Rainbow grades: HW1-6, Quiz1-5, Exam1 n Still grading: HW7, Quiz6, Exam2 Intro to Haskell n HW8 due today n HW9, Haskell, out tonight, due Nov. 16 th n Individual assignment n Start early!
More informationLinked lists and the List class
Linked lists and the List class Cheong 1 Linked lists So far, the only container object we used was the array. An array is a single object that contains references to other objects, possibly many of them.
More informationWellesley College CS251 Programming Languages Spring, 2000 FINAL EXAM REVIEW PROBLEM SOLUTIONS
Wellesley College CS251 Programming Languages Spring, 2000 FINAL EXAM REVIEW PROBLEM SOLUTIONS This document contains solutions to the problems on the final exam review problems posted earlier except for
More informationAn Introduction to Apache Spark Big Data Madison: 29 July William Red Hat, Inc.
An Introduction to Apache Spark Big Data Madison: 29 July 2014 William Benton @willb Red Hat, Inc. About me At Red Hat for almost 6 years, working on distributed computing Currently contributing to Spark,
More informationScripting Language Basics. CSE/BENG/BIMM 182 September 28, 2009
Scripting Language Basics CSE/BENG/BIMM 182 September 28, 2009 Scripting Languages Examples: Perl (Documentation: http://www.perl.org/docs.html) and Python (Documentation: http://docs.python.org/) Advantages:
More informationJava Collections The Force Awakens.
Java Collections The Force Awakens Darth @RaoulUK Darth @RichardWarburto Collection Problems Java Episode 8 & 9 Persistent & Immutable Collections HashMaps Collection bugs 1. 2. 3. Element access (Off-by-one
More informationUnit #2: Recursion, Induction, and Loop Invariants
Unit #2: Recursion, Induction, and Loop Invariants CPSC 221: Algorithms and Data Structures Will Evans 2012W1 Unit Outline Thinking Recursively Recursion Examples Analyzing Recursion: Induction and Recurrences
More information