SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Project Fortress
          Alex Miller




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

                                  http://www.ïŹ‚ickr.com/photos/ïŹnkle/3111290180/
Wednesday, July 1, 2009
Um, no.



Wednesday, July 1, 2009
Modern language design

                                  +

                          ScientiïŹc 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 - ïŹ‚oating 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
               deïŹning 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 deïŹne a       Also can do preïŹx, inïŹx,
                 postïŹx operator here        noïŹx, multiïŹx, 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 ïŹx



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 ïŹnal class
         trait Cat extends Animal

                                                    ïŹelds, 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 - speciïŹes pre-
                                              conditions on incoming
            for k<-seq(1:10) do
              println k "! = " factorial(k)

                                              arguments
            end
          end
          end

                                              ensures - speciïŹes 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 deïŹned in their own ïŹle 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 ïŹrst 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

Weitere Àhnliche Inhalte

Was ist angesagt?

"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
 
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
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + ClojureCloudera, Inc.
 
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
 
The STL
The STLThe STL
The STLadil raja
 

Was ist angesagt? (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
 

Andere mochten auch

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
 
Blogging ZOMG
Blogging ZOMGBlogging ZOMG
Blogging ZOMGAlex Miller
 
Cold Hard Cache
Cold Hard CacheCold Hard Cache
Cold Hard 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
 

Andere mochten auch (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
 

Ähnlich wie 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
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojureelliando dias
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And SwingSkills Matter
 
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
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUGjulien.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
 
Clojure intro
Clojure introClojure intro
Clojure introBasav Nagur
 
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
 
MTL Versus Free
MTL Versus FreeMTL Versus Free
MTL Versus FreeJohn De Goes
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course OutlineBaishampayan Ghose
 
Something about Golang
Something about GolangSomething about Golang
Something about GolangAnton Arhipov
 

Ähnlich wie 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
 

Mehr von 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
 
Java 7 Preview
Java 7 PreviewJava 7 Preview
Java 7 PreviewAlex Miller
 
Exploring Terracotta
Exploring TerracottaExploring Terracotta
Exploring TerracottaAlex Miller
 
Actor Concurrency
Actor ConcurrencyActor Concurrency
Actor ConcurrencyAlex Miller
 

Mehr von 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
 

KĂŒrzlich hochgeladen

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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
🐬 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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

KĂŒrzlich hochgeladen (20)

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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Project Fortress

  • 1. Project Fortress Alex Miller http://www.ïŹ‚ickr.com/photos/micbaun/1216608114/ Wednesday, July 1, 2009
  • 2. Dude, isn’t Fortress like FORTRAN or something? http://www.ïŹ‚ickr.com/photos/ïŹnkle/3111290180/ Wednesday, July 1, 2009
  • 4. Modern language design + ScientiïŹc 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 - ïŹ‚oating 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 deïŹning 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 deïŹne a Also can do preïŹx, inïŹx, postïŹx operator here noïŹx, multiïŹx, 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 ïŹx 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 ïŹnal class trait Cat extends Animal ïŹelds, 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 - speciïŹes pre- conditions on incoming for k<-seq(1:10) do println k "! = " factorial(k) arguments end end end ensures - speciïŹes 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 deïŹned in their own ïŹle 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 ïŹrst 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