Clojure Lisp for the Real #clojure

Size: px
Start display at page:

Download "Clojure Lisp for the Real #clojure"

Transcription

1 Clojure Lisp for the Real #clojure 1

2 Bullet Points Values Code is data Generic data access Concurrency 2

3 Stuart Sierra Relevance, Inc. Clojure/core Clojure contributor 3

4 Values 4

5 Values 3 5

6 Values = 5 6

7 Values let x = 3 7

8 Values let x = 3 let x = 5 8

9 Values let 3 = 5 9

10 Values define 3 = 5 10

11 Values 3 11

12 Values Immutable 3 12

13 Values Immutable 3 Persistent 13

14 " He llo, world! " 14

15 char greeting[14]; strcpy(greeting, "Hello, World!"); greeting H e l l o, w o r l d! \0 15

16 char* name = greeting + 7; greeting name H e l l o, w o r l d! \0 16

17 name[7] = 'b'; name[10] = 'e'; greeting name H e l l o, b o r e d! \0 17

18 String greeting = new String("Hello, world!"); greeting java.lang.string H e l l o, w o r l d! 18

19 String alt = greeting.replace("world", "bored"); greeting java.lang.string H e l l o, w o r l d! alt java.lang.string H e l l o, b o r e d! 19

20 greeting java.lang.string H e l l o, w o r l d! Immutable 20

21 In the real world, values don't change. 21

22 Clojure Values 3 Long 6.022e23 Double "Hello, world!" String 3.0M BigDecimal N BigInt 2/3 Ratio 22

23 Clojure Values even? :last-name (print 99 "bottles") Symbol Keyword List [3.14 :pi] Vector {:x 3 "y" 4} Map #{7 9 "foo"} Set 23

24 Clojure Values Immutable Persistent 24

25 String alt = greeting.replace("world", "bored"); greeting java.lang.string H e l l o, w o r l d! alt java.lang.string H e l l o, b o r e d! 25

26 Clojure Values List O(1) at the head O(n) anywhere else Vector O(log32n) access Map O(log32n) access Set O(log32n) contains? 26

27

28 32 1 = = = 32, = 1,048, = 33,554, = 1,073,741, = 34,359,738,368 28

29 log < 2 log32 10,000 < 3 log32 1,000,000 < 4 log32 10,000,000 < 5 log32 1,000,000,000 < 6 29

30 In the real world, log32n is fast enough. 30

31 Code is Data 31

32 Code is Data #{ {:first "Stuart" :last "Sierra"} {:first "Luke" :last "VanderHart"} {:first "Michael" :last "Fogus"} } 32

33 Code is Data #{ {:first "Stuart" :last "Sierra"} {:first "Luke" :last "VanderHart"} {:first "Michael" :last "Fogus"} } A set of maps 33

34 Symbol List ( ) 34

35 Symbol List ( ) Function call 35

36 Symbols Symbols List Vector Function call (defn average [& nums] (/ (reduce + nums) (count nums))) (average 3 4 5) 36

37 Host Interop. constructor (def m (ConcurrentHashMap. 100)) (.put m "key" "value") method call 37

38 You Characters Lexer/Parser Abstract Syntax Tree Compiler/ Interpreter 38

39 You Characters Clojure Reader Data Structures Clojure Compiler 39

40 You Characters Clojure Reader Macros Data Structures Clojure Compiler 40

41 (let [file...initializer...] (try... do something... (finally (.close file)))) 41

42 (defmacro with-open [bindings & body] `(let ~bindings (try (finally (.close ~(first bindings))))) 42

43 (let [file...initializer...] (try... do something... (finally (.close file)))) 43

44 (with-open [file...initializer...]... do something...) 44

45 Generic data access 45

46 Generic data access #{ {:first "Stuart" :last "Sierra"} {:first "Luke" :last "VanderHart"} {:first "Michael" :last "Fogus"} } A set of maps 46

47 Author[] authors =... String names[] = new names[authors.length]; for (int i = 0; i < authors.length; i++) { names[i] = authors[i].getfirstname(); } 47

48 (defn get-first-name [author] (get author :first)) (map get-first-name authors) ("Stuart" "Luke" "Michael") Higher-order function 48

49 Anonymous function (map (fn [a] (get a :first)) authors) ("Stuart" "Luke" "Michael") 49

50 Anonymous function (map #(get % :first) authors) ("Stuart" "Luke" "Michael") 50

51 Maps are functions (map #(% :first) authors) ("Stuart" "Luke" "Michael") 51

52 Keywords are functions! (map #(:first %) authors) ("Stuart" "Luke" "Michael") 52

53 Keywords are functions (map :first authors) ("Stuart" "Luke" "Michael") 53

54 String names[] = new names[authors.length]; for (int i = 0; i < authors.length; i++) { names[i] = authors[i].getname(); } vs. (map :first authors) 54

55 (map function set-of-maps) 55

56 (map function map-of-maps) (map function list-of-vectors) (map function vector-of-sets-of-maps) (map function set-of-maps) 56

57 (map function map-of-maps) (map function list-of-vectors) (map function vector-of-sets-of-maps) (map function set-of-maps) (map function (file-seq directory)) (map function (line-seq file)) (map function (xml-seq xml-tree)) (map function (resultset-seq query)) 57

58 Sequence API Sequence Generators map filter reduce count some remove replace and lots more... List Vector Map ResultSet Stream Directory Iterator XML and lots more... 58

59 Polymorphism 59

60 Object-Oriented, The Good Parts 60

61 dispatch function method method multimethod method method method 61

62 method protocol method method method Protocol method protocol method method method 62

63 Existing Interfaces Your new protocol here Existing Types Existing Method Implementations Your new type here and here! 63

64 The Expression Problem Sierra "Solving the Expression Problem with Clojure 1.2" IBM DeveloperWorks Chris Houser "Clojure's Solutions to the Expression Problem" Strange Loop

65 Concurrency 65

66 Parallelism Concurrency State 66

67 class Invoice { private Date date; public Date getdate() { } return this.date; } public void setdate(date date) { } this.date = date; 67

68 class Date { public void setday(int day); public void setmonth(int month); public void setyear(int year); } Mutable! 68

69 class Invoice { private Date date; public Date getdate() { } return this.date; public void setdate(date date) { this.date = date; } } Better not change it! 69

70 class Invoice { private Date date; public Date getdate() { return this.date; Better not change it! } public void setdate(date date) { } this.date = date; } Better not change it! 70

71 Programming with immutable values means never having to say you're sorry. 71

72 today July 25 72

73 today July 25 July 26 73

74 Identity today State July 25 Value July 26 Value 74

75 Identity today State July 25 function July 26 Value Value 75

76 Identity today State July 24 function July 25 function July 26 Past Present Future 76

77 Identity today State July 24 function July 25 function July 26 Past Present Future The future is a function of the past. 77

78 Mutable References Ref Atom Var Agent 78

79 readers writer Atom writer retry abort 79

80 Atom (def tick (atom 1)) 1 (deref tick) 1 tick 80

81 Atom (def tick (atom 1)) (deref tick) 1 (swap! tick 2 tick 1 inc 2 81

82 Atom (def tick (atom 1)) (deref tick) 1 (swap! tick 2 (swap! tick + 12 tick

83 value value value value identity value value value value identity identity value value value value 83

84 value value value value identity value value value value identity identity value value value value 84

85 readers Ref writer writer transaction retry abort Ref 85

86 Ref (def A (ref 1)) (def B (ref 10)) A 1 B 10 86

87 Ref (def A (ref 1)) (def B (ref 10)) (dosync (alter A inc) (alter B + 10)) A 1 B inc 2 transaction 87

88 Ref (def A (ref 1)) (def B (ref 10)) (dosync (alter A inc) (alter B A B

89 Database Transactions Atomic Consistent Isolated Durable 89

90 Clojure Transactions Atomic Consistent Isolated 90

91 readers action queue action action Agent Agent Thread Pool 91

92 Agent (def A (agent 1)) queue A 1 92

93 Agent (def A (agent 1)) (send A 1 queue inc A 1 93

94 Agent (def A (agent 1)) (send A 1 queue A

95 other threads Var root binding binding threadlocal threadlocal binding 95

96 Concurrency Ref Atom Var Agent 96

97 In the real world, JavaScript is everywhere 97

98 ClojureScript 98

99 More Clojure: clojure.org Clojure/core: clojure.com Me: Image Credits openclipart.org pdtextures.blogspot.com Clojure logo by Tom Hickey 99

Clojure Lisp for the Real clojure.com

Clojure Lisp for the Real clojure.com Clojure Lisp for the Real World @stuartsierra clojure.com Stuart Sierra Relevance, Inc. Clojure/core Clojure contributor Values Values 3 Values 3 + 2 = 5 Values let x = 3 Values let x = 3 let x = 5 Values

More information

Introduction Basics Concurrency Conclusion. Clojure. Marcel Klinzing. December 13, M. Klinzing Clojure 1/18

Introduction 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 information

Clojure is. A dynamic, LISP-based. programming language. running on the JVM

Clojure 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 information

Stuart

Stuart 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 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 .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 information

The Curious Clojureist

The 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

Clojure. A Dynamic Programming Language for the JVM. Rich Hickey

Clojure. 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 information

Identity, State and Values

Identity, State and Values Identity, State and Values Clojure s approach to concurrency Rich Hickey Agenda Functions and processes Identity, State, and Values Persistent Data Structures Clojure s Managed References Q&A Functions

More information

Reference types in Clojure. April 2, 2014

Reference types in Clojure. April 2, 2014 Reference types in Clojure April 2, 2014 Clojure atoms, vars, refs, agents Software transactional memory 2 / 15 From The Joy of Clojure book Time The relative moments when events occur State A snapshot

More information

Persistent Data Structures and Managed References

Persistent Data Structures and Managed References Persistent Data Structures and Managed References Clojure s approach to Identity and State Rich Hickey Agenda Functions and processes Identity, State, and Values Persistent Data Structures Clojure s Managed

More information

Seminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh.

Seminar 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 information

June 27, 2014 EuroClojure 2014 Krakow, Poland. Components. Just Enough

June 27, 2014 EuroClojure 2014 Krakow, Poland. Components. Just Enough June 27, 2014 EuroClojure 2014 Krakow, Poland Components Just Enough Structure @stuartsierra Presentation Business Logic DB SMS Email Presentation Thread Pool Business Logic Queues Public API Private API

More information

ClojureScript. as a compilation target to JS. Michiel Vijay FP AMS October 16th 2014

ClojureScript. 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 information

Clojure. A Dynamic Programming Language for the JVM. (and CLR) Rich Hickey

Clojure. A Dynamic Programming Language for the JVM. (and CLR) Rich Hickey Clojure A Dynamic Programming Language for the JVM (and CLR) Rich Hickey Agenda Fundamentals Rationale Feature Tour Integration with the JVM Q&A Clojure Fundamentals Dynamic a new Lisp, not Common Lisp

More information

Tackling Concurrency With STM. Mark Volkmann 10/22/09

Tackling 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 information

Tackling Concurrency With STM

Tackling 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 information

Clojure: Enemy of the State

Clojure: Enemy of the State Clojure: Enemy of the State * * Not actually an enemy of the state, or state in general. :) Alex Miller @puredanger Roadmap Values vs objects Collections Sequences Generic data interfaces Identity and

More information

Lazytest Better Living Through Protocols. Stuart Sierra. Clojure NYC April 15, 2010

Lazytest Better Living Through Protocols. Stuart Sierra. Clojure NYC April 15, 2010 Lazytest Better Living Through Protocols Stuart Sierra Clojure NYC April 15, 2010 @stuartsierra #clojure clojure.core: tests as metadata (defn add ([x y] (+ x y)) {:test (fn [] (assert (= 7 (add 3 4))))})

More information

Clojure. 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 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 information

What if Type Systems were more like Linters?

What if Type Systems were more like Linters? Typed Clojure An optional type system for Clojure What if Type Systems were more like Linters? Ambrose Bonnaire-Sergeant Me A Practical Optional Type System for Clojure (2012) Typed Clojure Indiegogo Campaign

More information

Multi-core Parallelization in Clojure - a Case Study

Multi-core Parallelization in Clojure - a Case Study Multi-core Parallelization in Clojure - a Case Study Johann M. Kraus and Hans A. Kestler AG Bioinformatics and Systems Biology Institute of Neural Information Processing University of Ulm 29.06.2009 Outline

More information

Macro #clojureconj

Macro #clojureconj Macro Club @stuartsierra #clojureconj 500 sq ft I ( ) If it seems simple, you're probably doing it wrong. You can pry EMACS from my cold, dead fingers. The First Rule of Macro Club You do not

More information

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. 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 information

Michiel DomCode, May 26th 2015

Michiel DomCode, May 26th 2015 ClojureScript ReactJS Michiel Borkent @borkdude DomCode, May 26th 2015 Michiel Borkent (@borkdude) Clojure(Script) developer at Clojure since 2009 Former lecturer, taught Clojure Agenda Part 1: ClojureScript

More information

FRP in ClojureScript with Javelin

FRP in ClojureScript with Javelin FRP in ClojureScript with Javelin Alan Dipert @alandipert THE freshdiet Fresh, Gourmet, Delivered Daily nginx jetty syslog-ng redis postgres fn fn val val val (+ 1 (* 2 3)) + * 1 2 3 Applicative Evaluation

More information

Clojure 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 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 information

Clojure. The Revenge of Data. by Vjeran Marcinko Kapsch CarrierCom

Clojure. The Revenge of Data. by Vjeran Marcinko Kapsch CarrierCom Clojure The Revenge of Data by Vjeran Marcinko Kapsch CarrierCom Data Processing is what we do Most programs receive, transform, search, and send data Data is raw, immutable information In its essence,

More information

Introduction to Clojure Concurrency (and data structures)

Introduction 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 information

Advanced MEIC. (Lesson #18)

Advanced MEIC. (Lesson #18) Advanced Programming @ MEIC (Lesson #18) Last class Data races Java Memory Model No out-of-thin-air values Data-race free programs behave as expected Today Finish with the Java Memory Model Introduction

More information

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.)

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) David Haraburda January 30, 2013 1 Introduction Scala is a multi-paradigm language that runs on the JVM (is totally

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors. Jonas Bonér Viktor Klang

Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors. Jonas Bonér Viktor Klang Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors Jonas Bonér Viktor Klang We believe that... Writing correct concurrent applications is too hard Scaling out applications is too hard

More information

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion Week 2: The Clojure Language Background Basic structure A few of the most useful facilities A modernized Lisp Review of Lisp's origins and development Why did Lisp need to be modernized? Relationship to

More information

Robot Programming with Lisp

Robot 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 information

Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors. Jonas Bonér Scalable Solutions

Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors. Jonas Bonér Scalable Solutions Akka: Simpler Concurrency, Scalability & Fault-tolerance through Actors Jonas Bonér Scalable Solutions jonas@jonasboner.com twitter: @jboner The problem It is way too hard to build: 1. correct highly concurrent

More information

This tutorial is designed for all those software professionals who are keen on learning the basics of Clojure and how to put it into practice.

This tutorial is designed for all those software professionals who are keen on learning the basics of Clojure and how to put it into practice. About the Tutorial Clojure is a high level, dynamic functional programming language. It is designed, based on the LISP programming language, and has compilers that makes it possible to be run on both Java

More information

Applied Unified Ownership. Capabilities for Sharing Across Threads

Applied Unified Ownership. Capabilities for Sharing Across Threads Applied Unified Ownership or Capabilities for Sharing Across Threads Elias Castegren Tobias Wrigstad DRF transfer parallel programming AppliedUnified Ownership memory management placement in pools (previous

More information

Objectives. Introduce static keyword examine syntax describe common uses

Objectives. Introduce static keyword examine syntax describe common uses Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method

More information

Clojure & Incanter for Java Programmers

Clojure & Incanter for Java Programmers Clojure & Incanter for Java Programmers Ben Evans (@kittylyst) One half of (@java7developer) Slide Design by http://www.kerrykenneally.com 1 Who is this guy anyway? 2 Who is this guy anyway? 3 Demo Details

More information

Functional Programming and the Web

Functional 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 information

CSCI-GA Scripting Languages

CSCI-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 information

MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science. Issued: Wed. 26 April 2017 Due: Wed.

MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science. Issued: Wed. 26 April 2017 Due: Wed. ps.txt Fri Apr 07 14:24:11 2017 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.945 Spring 2017 Problem Set 9 Issued: Wed. 26 April 2017 Due: Wed. 12

More information

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the

More information

Ohad Barzilay and Oranit Dror

Ohad Barzilay and Oranit Dror The String Class Represents a character string (e.g. "Hi") Implicit constructor: String quote = "Hello World"; string literal All string literals are String instances Object has a tostring() method More

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Lesson 6 - Defining a Programming Language Bottom Up Collaboration and Management - Elements of Programming Dana Fisman 1 What we accomplished

More information

Java SE 8 Programming

Java SE 8 Programming Oracle University Contact Us: +52 1 55 8525 3225 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming

More information

Clojure Distilled. Immutable

Clojure Distilled. Immutable Clojure Distilled The difficulty in learning Clojure does not stem from its syntax, which happens to be extremely simple, but from having to learn new methods for solving problems. As such, we'll focus

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

Introduction to Locks. Intrinsic Locks

Introduction to Locks. Intrinsic Locks CMSC 433 Programming Language Technologies and Paradigms Spring 2013 Introduction to Locks Intrinsic Locks Atomic-looking operations Resources created for sequential code make certain assumptions, a large

More information

Lists, loops and decisions

Lists, loops and decisions Caltech/LEAD Summer 2012 Computer Science Lecture 4: July 11, 2012 Lists, loops and decisions Lists Today Looping with the for statement Making decisions with the if statement Lists A list is a sequence

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

Making New Pseudo-Languages with C++

Making New Pseudo-Languages with C++ Making New Pseudo-Languages with C++ Build You a C++ For Great Good ++ A 10,000 Metre Talk by David Williams-King Agenda 1/4 Introduction 2/4 Polymorphism & Multimethods 3/4 Changing the Behaviour of C++

More information

Grand Central Dispatch. Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10

Grand Central Dispatch. Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10 Grand Central Dispatch Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10 1 New Technologies in Snow Leopard 2 Grand Central Dispatch An Apple technology to optimize application support

More information

Executable Formal Specifications with Clojure. Matti Nieminen

Executable Formal Specifications with Clojure. Matti Nieminen Executable Formal Specifications with Clojure Matti Nieminen University of Tampere School of Information Sciences Computer Science M.Sc. Thesis Supervisor: Jyrki Nummenmaa June 2015 University of Tampere

More information

Java SE 8 Programming

Java SE 8 Programming Java SE 8 Programming Training Calendar Date Training Time Location 16 September 2019 5 Days Bilginç IT Academy 28 October 2019 5 Days Bilginç IT Academy Training Details Training Time : 5 Days Capacity

More information

Comp 333: Concepts of Programming Languages Fall 2016

Comp 333: Concepts of Programming Languages Fall 2016 Comp 333: Concepts of Programming Languages Fall 2016 Instructor: Professor Schwartz History Syntax and Semantics Compilers Language Constructs Names, Binding, Scoping, Data Types Expressions, Control

More information

Look at all these toys!

Look at all these toys! Look at all these toys! Help it s Ruby! All alone Is Ruby dying? Where do Rubyists go? Where do Rubyists go? Tobias Pfeiffer @PragTob pragtob.info 673 Responses First Rails Release Rails 1.0 Why did

More information

Favoring Isolated Mutability The Actor Model of Concurrency. CSCI 5828: Foundations of Software Engineering Lecture 24 04/11/2012

Favoring Isolated Mutability The Actor Model of Concurrency. CSCI 5828: Foundations of Software Engineering Lecture 24 04/11/2012 Favoring Isolated Mutability The Actor Model of Concurrency CSCI 5828: Foundations of Software Engineering Lecture 24 04/11/2012 1 Goals Review the material in Chapter 8 of the Concurrency textbook that

More information

CS 2340 Objects and Design - Scala

CS 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 information

Java 8 Programming for OO Experienced Developers

Java 8 Programming for OO Experienced Developers www.peaklearningllc.com Java 8 Programming for OO Experienced Developers (5 Days) This course is geared for developers who have prior working knowledge of object-oriented programming languages such as

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

DOT NET Syllabus (6 Months)

DOT NET Syllabus (6 Months) DOT NET Syllabus (6 Months) THE COMMON LANGUAGE RUNTIME (C.L.R.) CLR Architecture and Services The.Net Intermediate Language (IL) Just- In- Time Compilation and CLS Disassembling.Net Application to IL

More information

Programming Clojure. Extracted from: Second Edition. The Pragmatic Bookshelf

Programming Clojure. Extracted from: Second Edition. The Pragmatic Bookshelf Extracted from: Programming Clojure Second Edition This PDF file contains pages extracted from Programming Clojure, published by the Pragmatic Bookshelf. For more information or to purchase a paperback

More information

Shared state model. April 3, / 29

Shared 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 information

Java SE 8 Programming

Java SE 8 Programming Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features

More information

Lecture 7. Memory in Python

Lecture 7. Memory in Python Lecture 7 Memory in Python Announcements For This Lecture Readings Reread Chapter 3 No reading for Thursday Lab Work on Assignment Credit when submit A Nothing else to do Assignment Moved to Fri, Sep.

More information

Page 1

Page 1 Java 1. Core java a. Core Java Programming Introduction of Java Introduction to Java; features of Java Comparison with C and C++ Download and install JDK/JRE (Environment variables set up) The JDK Directory

More information

A Practical Optional Type System for Clojure. Ambrose Bonnaire-Sergeant

A 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 information

Introduction. Example Databases

Introduction. Example Databases Introduction Example databases Overview of concepts Why use database systems Example Databases University Data: departments, students, exams, rooms,... Usage: creating exam plans, enter exam results, create

More information

Reagent. a ClojureScript interface to React. React Amsterdam Meetup 12 Feb. 2015

Reagent. a ClojureScript interface to React. React Amsterdam Meetup 12 Feb. 2015 Reagent a ClojureScript interface to React React Amsterdam Meetup 12 Feb. 2015 Michiel Borkent Twitter: @borkdude Email: michielborkent@gmail.com Clojure(Script) developer at Clojure since 2009 Former

More information

Programming in Scala Second Edition

Programming in Scala Second Edition Programming in Scala Second Edition Martin Odersky, Lex Spoon, Bill Venners artima ARTIMA PRESS WALNUT CREEK, CALIFORNIA Contents Contents List of Figures List of Tables List of Listings Foreword Foreword

More information

Advanced concurrent programming in Java Shared objects

Advanced concurrent programming in Java Shared objects Advanced concurrent programming in Java Shared objects Mehmet Ali Arslan 21.10.13 Visibility To see(m) or not to see(m)... 2 There is more to synchronization than just atomicity or critical sessions. Memory

More information

Implementing Symmetric Multiprocessing in LispWorks

Implementing Symmetric Multiprocessing in LispWorks Implementing Symmetric Multiprocessing in LispWorks Making a multithreaded application more multithreaded Martin Simmons, LispWorks Ltd Copyright 2009 LispWorks Ltd Outline Introduction Changes in LispWorks

More information

Introduction to Java https://tinyurl.com/y7bvpa9z

Introduction to Java https://tinyurl.com/y7bvpa9z Introduction to Java https://tinyurl.com/y7bvpa9z Eric Newhall - Laurence Meyers Team 2849 Alumni Java Object-Oriented Compiled Garbage-Collected WORA - Write Once, Run Anywhere IDE Integrated Development

More information

Kotlin/Native concurrency model. nikolay

Kotlin/Native concurrency model. nikolay Kotlin/Native concurrency model nikolay igotti@jetbrains What do we want from concurrency? Do many things concurrently Easily offload tasks Get notified once task a task is done Share state safely Mutate

More information

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction OGIES 6/7 A- Core Java The Core Java segment deals with the basics of Java. It is designed keeping in mind the basics of Java Programming Language that will help new students to understand the Java language,

More information

Manchester University Transactions for Scala

Manchester University Transactions for Scala Manchester University Transactions for Scala Salman Khan salman.khan@cs.man.ac.uk MMNet 2011 Transactional Memory Alternative to locks for handling concurrency Locks Prevent all other threads from accessing

More information

Parallelism. Master 1 International. Andrea G. B. Tettamanzi. Université de Nice Sophia Antipolis Département Informatique

Parallelism. Master 1 International. Andrea G. B. Tettamanzi. Université de Nice Sophia Antipolis Département Informatique Parallelism Master 1 International Andrea G. B. Tettamanzi Université de Nice Sophia Antipolis Département Informatique andrea.tettamanzi@unice.fr Andrea G. B. Tettamanzi, 2014 1 Lecture 5, Part a Languages

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

1Z Oracle. Java Platform Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert

1Z Oracle. Java Platform Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Oracle 1Z0-895 Java Platform Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Download Full Version : http://killexams.com/pass4sure/exam-detail/1z0-895 Answer: F QUESTION: 284 Given:

More information

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can

More information

TypeScript. Types. CS144: Web Applications

TypeScript. Types. CS144: Web Applications TypeScript Superset of JavaScript (a.k.a. JavaScript++) to make it easier to program for largescale JavaScript projects New features: types, interfaces, decorators,... All additional TypeScript features

More information

Lecture 5. Defining Functions

Lecture 5. Defining Functions Lecture 5 Defining Functions Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember the survey Readings Sections 3.5 3.3 today Also 6.-6.4 See online readings

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Quote of the Day. CS Functional Programming. Introductory Notes on Lisp/Clojure. Another Quote. What is Clojure? 1-4

Quote of the Day. CS Functional Programming. Introductory Notes on Lisp/Clojure. Another Quote. What is Clojure? 1-4 Quote of the Day CS 326 - Functional Programming Introductory Notes on Lisp/Clojure Dr. Stephen P. Carl By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more

More information

Clojure for OOP folks Stefan innoq

Clojure 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 information

END TERM EXAMINATION

END TERM EXAMINATION END TERM EXAMINATION THIRD SEMESTER [BCA] DECEMBER 2007 Paper Code: BCA 209 Subject: Object Oriented Programming Time: 3 hours Maximum Marks: 75 Note: Attempt all questions. Internal choice is indicated.

More information

Declarative concurrency. March 3, 2014

Declarative 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 information

Using Objects. a first example of an object classes and objects in Java

Using Objects. a first example of an object classes and objects in Java Using Objects a first example of an object classes and objects in Java classes vs. objects methods constructing an object mutators vs. accessors object references primitive values Strings are special Using

More information

Scala, Your Next Programming Language

Scala, 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 information

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

COMP 524 Spring 2018 Midterm Thursday, March 1

COMP 524 Spring 2018 Midterm Thursday, March 1 Name PID COMP 524 Spring 2018 Midterm Thursday, March 1 This exam is open note, open book and open computer. It is not open people. You are to submit this exam through gradescope. Resubmissions have been

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

COMP 401 Spring 2013 Midterm 1

COMP 401 Spring 2013 Midterm 1 COMP 401 Spring 2013 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page

More information

Programming Languages and Techniques (CIS120)

Programming 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 information

Principles of Software Construction: Objects, Design and Concurrency. Mutability and Java Potpourri. toad Fall 2013

Principles of Software Construction: Objects, Design and Concurrency. Mutability and Java Potpourri. toad Fall 2013 Principles of Software Construction: Objects, Design and Concurrency Mutability and Java Potpourri 15-214 toad Fall 2013 Jonathan Aldrich Charlie Garrod School of Computer Science 2012-13 C Garrod, J Aldrich,

More information

CSE 501N Final Fall Points Possible

CSE 501N Final Fall Points Possible Name CSE 501N Final Fall 2008 250 Points Possible True or False: 30 points (2 points each) 1.) True or False: Inner classes can be useful for exporting object state in an encapsulated way. 2.) True or

More information

.NET Advance Package Syllabus

.NET Advance Package Syllabus Module 1: Introduction to.net Lecture 1: About US: About SiSTech About your self Describe training methodology Lecture 2: What is.net? Application developed in.net Application development Architecture.Net

More information