SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Project Fortress
          Alex Miller




                          http://www.flickr.com/photos/micbaun/1216608114/
Wednesday, July 1, 2009
Dude, isn’t
                          Fortress like
                          FORTRAN or
                           something?

                                  http://www.flickr.com/photos/finkle/3111290180/
Wednesday, July 1, 2009
Um, no.



Wednesday, July 1, 2009
Modern language design

                                  +

                          Scientific computing


Wednesday, July 1, 2009
Features of interest
               Mathematical rendering
               Parallelism
               Software transactional memory
               Operator and function overloading
               Objects / traits
               Contracts
               Components / apis


Wednesday, July 1, 2009
Let’s build some basics




Wednesday, July 1, 2009
Types

               ZZ32, ZZ64 - signed integer types
               RR32, RR64 - floating point types

               String
               Boolean




Wednesday, July 1, 2009
juxtaposition


               3 4 evaluates to 12
               “a” “b” evaluates to “ab”

               log 1 evaluates to 0




Wednesday, July 1, 2009
Ranges


               5:9 evaluates to [5,6,7,8,9]
               5:9:2 evaluates to [5,7,9]

               5#2 evaluates to [5,6]




Wednesday, July 1, 2009
Variables
               Immutable: name[:type] = value
               zero = 0
               zero:ZZ32 = 0
               Mutable: var name[:type] = value
               OR       name[:type] := value
               var sum = 0
               sum := 0


Wednesday, July 1, 2009
Now you’re dangerous.




Wednesday, July 1, 2009
A simple example
     component fact
     export Executable

     fact(n:ZZ32): ZZ32 =
       if n = 0 then 1
       else n fact(n-1)
       end

     run():()=do
       for k<-seq(1:10) do
         println " fact(" k ") = " fact(k)
       end
     end

     end




               Executable - a trait          juxtaposition as operator
               defining run()
                                             Parallelism - in terms, in for
               Rendering: ZZ32, <-, fonts
                                             seq() - force sequential

Wednesday, July 1, 2009
BIG ideas


               But factorial is just a big multiply...use aggregate PROD
               operator ∏ instead.
               This is known as a BIG operator.




Wednesday, July 1, 2009
More direct implementation
     component factp
     export Executable

     factp(n:ZZ32): ZZ32 =
       PROD [i <- 1:n] i

     run():()=do
       for k<-seq(1:10) do
         println " factp(" k ") = " factp(k)
       end
     end

     end




                 PROD = aggregate              Known as “BIG”
                 product                       operators
                 SUM = summation               You can make your own!
Wednesday, July 1, 2009
Operator overloading



               Would be nice to actually use the right mathematical
               operator ! instead of a function, wouldn’t it?




Wednesday, July 1, 2009
Let’s make it an operator
          component facto
          export Executable

          opr(n:ZZ32)! = PROD [i <- 1:n] i

          run():()=do
            for k<-seq(1:10) do
              println k "! = " k!
            end
          end

          end




                 opr() used to define a       Also can do prefix, infix,
                 postfix operator here        nofix, multifix, or
                                             enclosing!

Wednesday, July 1, 2009
Lists
           evens = <|[ZZ32] 2,4,6,8,10|>
           println "evens: " evens

           evens2 = <|[ZZ32] 2 x | x <- 1:5|>
           println "evens2: " evens2

           odds = <|[ZZ32] e - 1 | e <- evens |>
           println "odds: " odds




               evens: <|2, 4, 6, 8, 10|>
               evens2: <|2, 4, 6, 8, 10|>
               odds: <|1, 3, 5, 7, 9|>


Wednesday, July 1, 2009
Another example
     component sos
     import List.{...}
     export Executable

     sumOfSquares(n:List[ZZ32]): ZZ64 = do
       sum:ZZ64 := 0
       for i<-0#|n| do
         sum += (n[i])^2
       end
       sum
     end

     run():()=do
       theList = <|[ZZ32] x | x<-1#100|>
       println "sumOfSquares = "
     sumOfSquares(theList)
     end

     end




                  What’s the bug? (Hint: think parallelism)


Wednesday, July 1, 2009
Implicit parallelism
               Many things implicitly parallel
                     for loops
                     parameters to a function call
                     do ... also ... end construct
               Here, for loop is parallel, so sum += is a data race
               Use atomic to fix



Wednesday, July 1, 2009
Atomic punk
         component sos
         import List.{...}                         Fortress uses Software
         export Executable
                                                   Transactional Memory
         sumOfSquares(n:List[ZZ32]): ZZ64 = do

                                                   atomic blocks executed all
           sum:ZZ64 := 0
           for i<-0#|n| do

                                                   or nothing
             atomic sum += (n[i])^2
           end
           sum

                                                   Retry on collision
         end

         run():()=do
           theList = <|[ZZ32] x | x<-1#100|>
           println "sumOfSquares = "               Transactions may nest
         sumOfSquares(theList)
         end
                                                   tryatomic
         end




Wednesday, July 1, 2009
Traits
         component traitexample
         export Executable
                                                  trait - like Java interface
         trait Animal
           talk():String
         end                                        methods - abstract or
         trait Fuzzy                                concrete
           howFuzzy():String
         end
                                                  object - like Java final class
         trait Cat extends Animal

                                                    fields, methods
           getter name():String
           talk() = "meow"
         end

         object Whiskers extends {Cat, Fuzzy}       constructors
           name() = "Whiskers"
           howFuzzy() = "real fuzzy"
         end                                      multiple inheritance
         run():() = do
           w:Whiskers = Whiskers                  getter / setter - metadata
           println w.name() " is " w.howFuzzy()
         end
         end
Wednesday, July 1, 2009
Function contracts
          component factc
          export Executable                   Documentation of
          factorial(n:ZZ32):ZZ32              semantic constraints
            requires { n >= 0 }
            ensures { outcome >= 0 }          beyond the type system.
            = PROD [i <- 1:n] i

          run():() = do                       requires - specifies pre-
                                              conditions on incoming
            for k<-seq(1:10) do
              println k "! = " factorial(k)

                                              arguments
            end
          end
          end

                                              ensures - specifies post-
                                              condition on “outcome”



Wednesday, July 1, 2009
Components and APIs


               Components modularize your program
               Components export and import APIs (NEVER other
               components, just APIs)
               APIs are explicitly defined in their own file type
               Repository for components



Wednesday, July 1, 2009
And more...
               Literal arrays, multi-dimensional arrays
               Maps, sets, skip lists, trees, heaps, sparse vectors and matrices,
               quick sort, etc in library
               Explicit thread spawn, memory region tree
               Function overloading
               Tuples
               Tests
               Functions as first class objects
               Exceptions



Wednesday, July 1, 2009
Whither next?


               Currently working on compiler
               Goal is to have it working in 6 months for a real
               bioinformatics project




Wednesday, July 1, 2009
For more...

               Project Home: http://projectfortress.sun.com/Projects/
               Community
               David Chase: http://www.infoq.com/presentations/
               chase-fortress
               Guy Steele, Eric Allen: http://tinyurl.com/md6f6g




Wednesday, July 1, 2009
Alex Miller


               Twitter: http://twitter.com/puredanger
               Blog: http://tech.puredanger.com
               Presentations: http://slideshare.net/alexmiller




Wednesday, July 1, 2009

Contenu connexe

Tendances

"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from..."PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...Edge AI and Vision Alliance
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksJinTaek Seo
 
Introduction to PyTorch
Introduction to PyTorchIntroduction to PyTorch
Introduction to PyTorchJun Young Park
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow규영 허
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)jeffz
 
Fun with Lambdas: C++14 Style (part 2)
Fun with Lambdas: C++14 Style (part 2)Fun with Lambdas: C++14 Style (part 2)
Fun with Lambdas: C++14 Style (part 2)Sumant Tambe
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slidesOCaml
 
JIT compilation for CPython
JIT compilation for CPythonJIT compilation for CPython
JIT compilation for CPythondelimitry
 
Software transactional memory. pure functional approach
Software transactional memory. pure functional approachSoftware transactional memory. pure functional approach
Software transactional memory. pure functional approachAlexander Granin
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The LandingHaci Murat Yaman
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014PyData
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Jan Wedekind
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1PyCon Italia
 
Objective-Cひとめぐり
Objective-CひとめぐりObjective-Cひとめぐり
Objective-CひとめぐりKenji Kinukawa
 
SPU Optimizations-part 1
SPU Optimizations-part 1SPU Optimizations-part 1
SPU Optimizations-part 1Naughty Dog
 
Functional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskFunctional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskAlexander Granin
 

Tendances (20)

Dive Into PyTorch
Dive Into PyTorchDive Into PyTorch
Dive Into PyTorch
 
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from..."PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
 
Introduction to PyTorch
Introduction to PyTorchIntroduction to PyTorch
Introduction to PyTorch
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
 
Fun with Lambdas: C++14 Style (part 2)
Fun with Lambdas: C++14 Style (part 2)Fun with Lambdas: C++14 Style (part 2)
Fun with Lambdas: C++14 Style (part 2)
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slides
 
JIT compilation for CPython
JIT compilation for CPythonJIT compilation for CPython
JIT compilation for CPython
 
Software transactional memory. pure functional approach
Software transactional memory. pure functional approachSoftware transactional memory. pure functional approach
Software transactional memory. pure functional approach
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1
 
Objective-Cひとめぐり
Objective-CひとめぐりObjective-Cひとめぐり
Objective-Cひとめぐり
 
SPU Optimizations-part 1
SPU Optimizations-part 1SPU Optimizations-part 1
SPU Optimizations-part 1
 
Functional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskFunctional programming in C++ LambdaNsk
Functional programming in C++ LambdaNsk
 
The STL
The STLThe STL
The STL
 

En vedette

Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrencyAlex Miller
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The CloudAlex Miller
 
Innovative Software
Innovative SoftwareInnovative Software
Innovative SoftwareAlex Miller
 
Releasing Relational Data to the Semantic Web
Releasing Relational Data to the Semantic WebReleasing Relational Data to the Semantic Web
Releasing Relational Data to the Semantic WebAlex Miller
 
Scaling Your Cache
Scaling Your CacheScaling Your Cache
Scaling Your CacheAlex Miller
 
Stream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinStream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinAlex Miller
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with TerracottaAlex Miller
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
Cracking clojure
Cracking clojureCracking clojure
Cracking clojureAlex Miller
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of AbstractionAlex Miller
 
Visualising Data on Interactive Maps
Visualising Data on Interactive MapsVisualising Data on Interactive Maps
Visualising Data on Interactive MapsAnna Pawlicka
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Kyung Koo Yoon
 
GPars: Groovy Parallelism for Java
GPars: Groovy Parallelism for JavaGPars: Groovy Parallelism for Java
GPars: Groovy Parallelism for JavaRussel Winder
 
Basics of Java Concurrency
Basics of Java ConcurrencyBasics of Java Concurrency
Basics of Java Concurrencykshanth2101
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gparsPaul King
 
Java concurrency
Java concurrencyJava concurrency
Java concurrencyducquoc_vn
 
groovy and concurrency
groovy and concurrencygroovy and concurrency
groovy and concurrencyPaul King
 

En vedette (20)

Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The Cloud
 
Innovative Software
Innovative SoftwareInnovative Software
Innovative Software
 
Releasing Relational Data to the Semantic Web
Releasing Relational Data to the Semantic WebReleasing Relational Data to the Semantic Web
Releasing Relational Data to the Semantic Web
 
Scaling Your Cache
Scaling Your CacheScaling Your Cache
Scaling Your Cache
 
Blogging ZOMG
Blogging ZOMGBlogging ZOMG
Blogging ZOMG
 
Cold Hard Cache
Cold Hard CacheCold Hard Cache
Cold Hard Cache
 
Stream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/joinStream Execution with Clojure and Fork/join
Stream Execution with Clojure and Fork/join
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with Terracotta
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Cracking clojure
Cracking clojureCracking clojure
Cracking clojure
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of Abstraction
 
Visualising Data on Interactive Maps
Visualising Data on Interactive MapsVisualising Data on Interactive Maps
Visualising Data on Interactive Maps
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
 
GPars: Groovy Parallelism for Java
GPars: Groovy Parallelism for JavaGPars: Groovy Parallelism for Java
GPars: Groovy Parallelism for Java
 
Basics of Java Concurrency
Basics of Java ConcurrencyBasics of Java Concurrency
Basics of Java Concurrency
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gpars
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
groovy and concurrency
groovy and concurrencygroovy and concurrency
groovy and concurrency
 

Similaire à Project Fortress

Subtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondSubtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondPatrick Diehl
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Jimmy Schementi
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Hyuk Hur
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Campjulien.ponge
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011julien.ponge
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap courseMartin Logan
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMRaveen Perera
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch
 
ClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browserClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browserFalko Riemenschneider
 
Something about Golang
Something about GolangSomething about Golang
Something about GolangAnton Arhipov
 

Similaire à Project Fortress (20)

Subtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff HammondSubtle Asynchrony by Jeff Hammond
Subtle Asynchrony by Jeff Hammond
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
JAVA SE 7
JAVA SE 7JAVA SE 7
JAVA SE 7
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap course
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
Erlang
ErlangErlang
Erlang
 
ClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browserClojureScript - A functional Lisp for the browser
ClojureScript - A functional Lisp for the browser
 
MTL Versus Free
MTL Versus FreeMTL Versus Free
MTL Versus Free
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
 

Plus de Alex Miller

Clojure/West Overview (12/1/11)
Clojure/West Overview (12/1/11)Clojure/West Overview (12/1/11)
Clojure/West Overview (12/1/11)Alex Miller
 
Concurrent Stream Processing
Concurrent Stream ProcessingConcurrent Stream Processing
Concurrent Stream ProcessingAlex Miller
 
Tree Editing with Zippers
Tree Editing with ZippersTree Editing with Zippers
Tree Editing with ZippersAlex Miller
 
Scaling Your Cache And Caching At Scale
Scaling Your Cache And Caching At ScaleScaling Your Cache And Caching At Scale
Scaling Your Cache And Caching At ScaleAlex Miller
 
Marshmallow Test
Marshmallow TestMarshmallow Test
Marshmallow TestAlex Miller
 
Strange Loop Conference 2009
Strange Loop Conference 2009Strange Loop Conference 2009
Strange Loop Conference 2009Alex Miller
 
Java Collections API
Java Collections APIJava Collections API
Java Collections APIAlex Miller
 
Java Concurrency Idioms
Java Concurrency IdiomsJava Concurrency Idioms
Java Concurrency IdiomsAlex Miller
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns ReconsideredAlex Miller
 
Exploring Terracotta
Exploring TerracottaExploring Terracotta
Exploring TerracottaAlex Miller
 
Actor Concurrency
Actor ConcurrencyActor Concurrency
Actor ConcurrencyAlex Miller
 

Plus de Alex Miller (12)

Clojure/West Overview (12/1/11)
Clojure/West Overview (12/1/11)Clojure/West Overview (12/1/11)
Clojure/West Overview (12/1/11)
 
Concurrent Stream Processing
Concurrent Stream ProcessingConcurrent Stream Processing
Concurrent Stream Processing
 
Tree Editing with Zippers
Tree Editing with ZippersTree Editing with Zippers
Tree Editing with Zippers
 
Scaling Your Cache And Caching At Scale
Scaling Your Cache And Caching At ScaleScaling Your Cache And Caching At Scale
Scaling Your Cache And Caching At Scale
 
Marshmallow Test
Marshmallow TestMarshmallow Test
Marshmallow Test
 
Strange Loop Conference 2009
Strange Loop Conference 2009Strange Loop Conference 2009
Strange Loop Conference 2009
 
Java Collections API
Java Collections APIJava Collections API
Java Collections API
 
Java Concurrency Idioms
Java Concurrency IdiomsJava Concurrency Idioms
Java Concurrency Idioms
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns Reconsidered
 
Java 7 Preview
Java 7 PreviewJava 7 Preview
Java 7 Preview
 
Exploring Terracotta
Exploring TerracottaExploring Terracotta
Exploring Terracotta
 
Actor Concurrency
Actor ConcurrencyActor Concurrency
Actor Concurrency
 

Dernier

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Dernier (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Project Fortress

  • 1. Project Fortress Alex Miller http://www.flickr.com/photos/micbaun/1216608114/ Wednesday, July 1, 2009
  • 2. Dude, isn’t Fortress like FORTRAN or something? http://www.flickr.com/photos/finkle/3111290180/ Wednesday, July 1, 2009
  • 4. Modern language design + Scientific computing Wednesday, July 1, 2009
  • 5. Features of interest Mathematical rendering Parallelism Software transactional memory Operator and function overloading Objects / traits Contracts Components / apis Wednesday, July 1, 2009
  • 6. Let’s build some basics Wednesday, July 1, 2009
  • 7. Types ZZ32, ZZ64 - signed integer types RR32, RR64 - floating point types String Boolean Wednesday, July 1, 2009
  • 8. juxtaposition 3 4 evaluates to 12 “a” “b” evaluates to “ab” log 1 evaluates to 0 Wednesday, July 1, 2009
  • 9. Ranges 5:9 evaluates to [5,6,7,8,9] 5:9:2 evaluates to [5,7,9] 5#2 evaluates to [5,6] Wednesday, July 1, 2009
  • 10. Variables Immutable: name[:type] = value zero = 0 zero:ZZ32 = 0 Mutable: var name[:type] = value OR name[:type] := value var sum = 0 sum := 0 Wednesday, July 1, 2009
  • 12. A simple example component fact export Executable fact(n:ZZ32): ZZ32 = if n = 0 then 1 else n fact(n-1) end run():()=do for k<-seq(1:10) do println " fact(" k ") = " fact(k) end end end Executable - a trait juxtaposition as operator defining run() Parallelism - in terms, in for Rendering: ZZ32, <-, fonts seq() - force sequential Wednesday, July 1, 2009
  • 13. BIG ideas But factorial is just a big multiply...use aggregate PROD operator ∏ instead. This is known as a BIG operator. Wednesday, July 1, 2009
  • 14. More direct implementation component factp export Executable factp(n:ZZ32): ZZ32 = PROD [i <- 1:n] i run():()=do for k<-seq(1:10) do println " factp(" k ") = " factp(k) end end end PROD = aggregate Known as “BIG” product operators SUM = summation You can make your own! Wednesday, July 1, 2009
  • 15. Operator overloading Would be nice to actually use the right mathematical operator ! instead of a function, wouldn’t it? Wednesday, July 1, 2009
  • 16. Let’s make it an operator component facto export Executable opr(n:ZZ32)! = PROD [i <- 1:n] i run():()=do for k<-seq(1:10) do println k "! = " k! end end end opr() used to define a Also can do prefix, infix, postfix operator here nofix, multifix, or enclosing! Wednesday, July 1, 2009
  • 17. Lists evens = <|[ZZ32] 2,4,6,8,10|> println "evens: " evens evens2 = <|[ZZ32] 2 x | x <- 1:5|> println "evens2: " evens2 odds = <|[ZZ32] e - 1 | e <- evens |> println "odds: " odds evens: <|2, 4, 6, 8, 10|> evens2: <|2, 4, 6, 8, 10|> odds: <|1, 3, 5, 7, 9|> Wednesday, July 1, 2009
  • 18. Another example component sos import List.{...} export Executable sumOfSquares(n:List[ZZ32]): ZZ64 = do sum:ZZ64 := 0 for i<-0#|n| do sum += (n[i])^2 end sum end run():()=do theList = <|[ZZ32] x | x<-1#100|> println "sumOfSquares = " sumOfSquares(theList) end end What’s the bug? (Hint: think parallelism) Wednesday, July 1, 2009
  • 19. Implicit parallelism Many things implicitly parallel for loops parameters to a function call do ... also ... end construct Here, for loop is parallel, so sum += is a data race Use atomic to fix Wednesday, July 1, 2009
  • 20. Atomic punk component sos import List.{...} Fortress uses Software export Executable Transactional Memory sumOfSquares(n:List[ZZ32]): ZZ64 = do atomic blocks executed all sum:ZZ64 := 0 for i<-0#|n| do or nothing atomic sum += (n[i])^2 end sum Retry on collision end run():()=do theList = <|[ZZ32] x | x<-1#100|> println "sumOfSquares = " Transactions may nest sumOfSquares(theList) end tryatomic end Wednesday, July 1, 2009
  • 21. Traits component traitexample export Executable trait - like Java interface trait Animal talk():String end methods - abstract or trait Fuzzy concrete howFuzzy():String end object - like Java final class trait Cat extends Animal fields, methods getter name():String talk() = "meow" end object Whiskers extends {Cat, Fuzzy} constructors name() = "Whiskers" howFuzzy() = "real fuzzy" end multiple inheritance run():() = do w:Whiskers = Whiskers getter / setter - metadata println w.name() " is " w.howFuzzy() end end Wednesday, July 1, 2009
  • 22. Function contracts component factc export Executable Documentation of factorial(n:ZZ32):ZZ32 semantic constraints requires { n >= 0 } ensures { outcome >= 0 } beyond the type system. = PROD [i <- 1:n] i run():() = do requires - specifies pre- conditions on incoming for k<-seq(1:10) do println k "! = " factorial(k) arguments end end end ensures - specifies post- condition on “outcome” Wednesday, July 1, 2009
  • 23. Components and APIs Components modularize your program Components export and import APIs (NEVER other components, just APIs) APIs are explicitly defined in their own file type Repository for components Wednesday, July 1, 2009
  • 24. And more... Literal arrays, multi-dimensional arrays Maps, sets, skip lists, trees, heaps, sparse vectors and matrices, quick sort, etc in library Explicit thread spawn, memory region tree Function overloading Tuples Tests Functions as first class objects Exceptions Wednesday, July 1, 2009
  • 25. Whither next? Currently working on compiler Goal is to have it working in 6 months for a real bioinformatics project Wednesday, July 1, 2009
  • 26. For more... Project Home: http://projectfortress.sun.com/Projects/ Community David Chase: http://www.infoq.com/presentations/ chase-fortress Guy Steele, Eric Allen: http://tinyurl.com/md6f6g Wednesday, July 1, 2009
  • 27. Alex Miller Twitter: http://twitter.com/puredanger Blog: http://tech.puredanger.com Presentations: http://slideshare.net/alexmiller Wednesday, July 1, 2009