SlideShare ist ein Scribd-Unternehmen logo
1 von 60
Downloaden Sie, um offline zu lesen
Frege
konsequent funktionale Programmierung
für die JVM
Dierk König
Canoo
mittie
Dierk König
Canoo
mittie
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2
2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1
1
2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 22
1 2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
2 1 2
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
2 1 2
state1 state2 state3
Why do we care?
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
2 1 2
time1
time2
time3
state1 state2 state3
Operational Reasoning
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
2 1 2
time1
time2
time3
state1 state2 state3
Operational Reasoning
a	
  =	
  1	
  
b	
  =	
  2	
  
c	
  =	
  b	
  
b	
  =	
  a	
  
a	
  =	
  c
1
1 2
1 2 2
1 1 2
2 1 2
time1
time2
time3
state1 state2 state3
Using functions
a	
  =	
  1	
  
b	
  =	
  2	
  
	
  	
  	
  	
  	
  	
  
1
1 2
Using functions
a	
  =	
  1	
  
b	
  =	
  2	
  
	
  	
  	
  	
  	
  	
  
1
1 2
2 1
swap(a,b)	
  =	
  (b,a)
The Key Idea
Assignments	
  change	
  state	
  and	
  
introduce	
  time.	
  
Statements	
  do	
  side	
  effects.	
  
Let’s	
  just	
  remove	
  them!
differentFrege is
differentFrege is very
You would not believe
just how different it is!
Online REPL
http://try.frege-lang.org
Define a Function
frege>	
  	
  times	
  a	
  b	
  =	
  a	
  *	
  b	
  
frege>	
  	
  times	
  3	
  4	
  
12	
  
frege>	
  :type	
  times	
  
Num	
  α	
  =>	
  α	
  -­‐>	
  α	
  -­‐>	
  α
Define a Function
frege>	
  	
  times	
  a	
  b	
  =	
  a	
  *	
  b	
  
frege>	
  (times	
  3)	
  4	
  
12	
  
frege>	
  :type	
  times	
  
Num	
  α	
  =>	
  α	
  -­‐>(α	
  -­‐>	
  α)
no types declared
function appl.
left associative
tell the inferred
type
typeclass
only 1
parameter!
return type is
a function!
thumb: „two params
of same numeric type
returning that type“
no comma
Reference a Function
frege>	
  twotimes	
  =	
  times	
  2	
  
frege>	
  twotimes	
  3	
  
6	
  	
  
frege>	
  :t	
  twotimes	
  
Int	
  -­‐>	
  Int
Reference a Function
frege>	
  twotimes	
  =	
  times	
  2	
  
frege>	
  twotimes	
  3	
  
6	
  
frege>	
  :t	
  twotimes	
  
Int	
  -­‐>	
  Int
No second
argument!
„Currying“, „schönfinkeling“,
or „partial function
application“.
Concept invented by
Gottlob Frege.
inferred types
are more specific
Function Composition
frege>	
  twotimes	
  (threetimes	
  2)	
  
12	
  
frege>	
  sixtimes	
  =	
  twotimes	
  .	
  threetimes	
  
frege>	
  sixtimes	
  2	
  
frege>	
  :t	
  sixtimes	
  
Int	
  -­‐>	
  Int
Function Composition
frege>	
  twotimes	
  (threetimes	
  2)	
  
12	
  
frege>	
  sixtimes	
  =	
  twotimes	
  .	
  threetimes	
  
frege>	
  sixtimes	
  2	
  
frege>	
  :t	
  sixtimes	
  
Int	
  -­‐>	
  Int
f(g(x))
more about this later
(f ° g) (x)
Pattern Matching
frege>	
  times	
  0	
  (threetimes	
  2)	
  
0	
  
frege>	
  times	
  0	
  b	
  =	
  0
Pattern Matching
frege>	
  times	
  0	
  (threetimes	
  2)	
  
0	
  
frege>	
  times	
  0	
  b	
  =	
  0
unnecessarily evaluated
shortcuttingpattern matching
Lazy Evaluation
frege>	
  times	
  0	
  (length	
  [1..])	
  
0
endless sequence
evaluation would never stop
Pattern matching and
non-strict evaluation
to the rescue!
Pure Functions
Java	
  
T	
  foo(Pair<T,U>	
  p)	
  {…}	
  
Frege	
  
foo	
  ::	
  (α,β)	
  -­‐>	
  α
What could
possibly happen?
What could
possibly happen?
Pure Functions
Java	
  
T	
  foo(Pair<T,U>	
  p)	
  {…}	
  
Frege	
  
foo	
  ::	
  (α,β)	
  -­‐>	
  α
Everything!

State changes, 

file or db access,
missile launch,…
a is returned
Pure Functions
can	
  be	
  cached	
  (memoized)

can	
  be	
  evaluated	
  lazily

can	
  be	
  evaluated	
  in	
  advance

can	
  be	
  evaluated	
  concurrently

can	
  be	
  eliminated	
  

	
  	
  	
  	
  in	
  common	
  subexpressions	
  
can	
  be	
  optimized
Java Interoperability
do not mix OO and FP
combine them
Java -> Frege
Scripting:	
  JSR	
  223	
  
Service:

	
   	
   	
   compile	
  *.fr	
  file

	
   	
   	
   call	
  static	
  method
simple
pure native encode java.net.URLEncoder.encode :: String -> String
encode “Dierk König“


native millis java.lang.System.currentTimeMillis :: () -> IO Long
millis ()
millis ()
past = millis () - 1000 

Does not compile!
Frege -> Java
This is a key distinction between Frege and

other JVM languages!
even Java can be pure
Frege
allows	
  calling	
  Java

	
  	
  	
  but	
  never	
  unprotected!	
  
is	
  explicit	
  about	
  effects

	
  	
  	
  just	
  like	
  Haskell	
  
Type System
Ubiquitous static typing allows

global type inference and thus more
safety and less work for the programmer

You don’t need to specify any types at all!
But sometimes you do anyway…
Mutable

I/O
Mutable
Mutable
Keep the mess out!
Pure Computation
Pure Computation
Pure Computation
Mutable

I/O
Mutable
Mutable
Keep the mess out!
Pure Computation
Pure Computation
Pure Computation
Ok, these are Monads. Be brave. Think of them as contexts
that the type system propagates and makes un-escapable.
Thread-
safe by
design!
Checked
by
compiler
Some Cool Stuff
Zipping
addzip	
  []	
  _	
  	
  =	
  []

addzip	
  _	
  	
  []	
  =	
  []	
  	
  
addzip	
  (x:xs)	
  (y:ys)	
  =	
  

	
  	
  	
  	
  	
  	
  	
  (x	
  +	
  y	
  :	
  addzip	
  xs	
  ys	
  )
Zipping
addzip	
  []	
  _	
  	
  =	
  []

addzip	
  _	
  	
  []	
  =	
  []	
  	
  
addzip	
  (x:xs)	
  (y:ys)	
  =	
  

	
  	
  	
  	
  	
  	
  	
  (x	
  +	
  y	
  :	
  addzip	
  xs	
  ys	
  )



use as
addzip	
  [1,2,3]	
  	
  
	
  	
  	
  	
  	
  	
  	
  [1,2,3]	
  	
  
	
  	
  	
  	
  ==	
  [2,4,6]
Pattern matching
feels like Prolog
Why only for the (+) function?
We could be more general…
High Order Functions
zipWith	
  f	
  []	
  _	
  	
  =	
  []

zipWith	
  f	
  _	
  	
  []	
  =	
  []	
  	
  
zipWith	
  f	
  (x:xs)	
  (y:ys)	
  =	
  

	
  	
  	
  	
  	
  	
  	
  (f	
  x	
  y	
  :	
  zipWith	
  xs	
  ys	
  )	
  
High Order Functions
zipWith	
  f	
  []	
  _	
  	
  =	
  []

zipWith	
  f	
  _	
  	
  []	
  =	
  []	
  	
  
zipWith	
  f	
  (x:xs)	
  (y:ys)	
  =	
  

	
  	
  	
  	
  	
  	
  	
  (f	
  x	
  y	
  :	
  zipWith	
  xs	
  ys	
  )
use as
zipWith	
  (+)	
  [1,2,3]	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [1,2,3]	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  ==	
  [2,4,6]	
  
and, yes we can now define
	
   addzip	
  =	
  	
  	
   	
  
	
   	
   	
   zipWith	
  (+)	
  	
  	
  
invented by Gottlob Frege
Fizzbuzz
http://c2.com/cgi/wiki?FizzBuzzTest
https://dierk.gitbooks.io/fregegoodness/

chapter 8 „FizzBuzz“
Fizzbuzz Imperative
public	
  class	
  FizzBuzz{

	
  	
  public	
  static	
  void	
  main(String[]	
  args){

	
  	
  	
  	
  for(int	
  i=	
  1;	
  i	
  <=	
  100;	
  i++){

	
  	
  	
  	
  	
  	
  if(i	
  %	
  15	
  ==	
  0{	
  	
  

	
  	
  	
  	
  	
  	
  	
  	
  System.out.println(„FizzBuzz");

	
  	
  	
  	
  	
  	
  }else	
  if(i	
  %	
  3	
  ==	
  0){

	
  	
  	
  	
  	
  	
  	
  	
  System.out.println("Fizz");

	
  	
  	
  	
  	
  	
  }else	
  if(i	
  %	
  5	
  ==	
  0){

	
  	
  	
  	
  	
  	
  	
  	
  System.out.println("Buzz");

	
  	
  	
  	
  	
  	
  }else{

	
  	
  	
  	
  	
  	
  	
  	
  System.out.println(i);

}	
  }	
  }	
  }
Fizzbuzz Logical
fizzes	
  	
  	
  =	
  cycle	
  	
  	
  ["",	
  "",	
  "fizz"]

buzzes	
  	
  	
  =	
  cycle	
  	
  	
  ["",	
  "",	
  "",	
  "",	
  "buzz"]

pattern	
  	
  =	
  zipWith	
  (++)	
  fizzes	
  buzzes	
  
fizzbuzz	
  =	
  zipWith	
  (max	
  .	
  show)	
  pattern	
  [1..]	
  	
  
main	
  _	
  	
  	
  =	
  do

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  for	
  (take	
  100	
  fizzbuzz)	
  println
Fizzbuzz Comparison
Imperative Logical
Conditionals 4 0
Operators 7 1
Nesting level 3 0
Sequencing sensitive transparent
Maintainability - - - +
History
Java promise: „No more pointers!“
But NullPointerExceptions (?)
Frege is different
No More But
state no state (unless declared)
statements expressions (+ „do“ notation)
assignments definitions
variables ST monad as „agent“
interfaces type classes
classes & objects algebraic data types
inheritance parametric polymorphism
null references Maybe
NullPointerExceptions Bottom, error
Frege in comparison
practical
safe
Java
Groovy
Frege
Haskell
Frege in comparison
safe
Java
Groovy
Frege
Haskell
concept by 

Simon Peyton-Jones
Frege makes the Haskell spirit
accessible to the Java programmer
and provides a new level of safety.
apply logic
run computers
practical
Why Frege
Robustness under parallel execution

Robustness under composition

Robustness under increments

Robustness under refactoring
Enables local and equational reasoning
Best way to learn FP
How?
http://www.frege-­‐lang.org

@fregelang

stackoverflow	
  „frege“	
  tag

edX	
  FP101	
  MOOC	
  (start	
  Oct	
  15th!)	
  
Gottlob 

Frege
"As I think about acts of integrity and grace, 

I realise that there is nothing in my knowledge
that compares with Frege’s dedication to truth…
It was almost superhuman.“ —Bertrand Russel
"Not many people managed to create a revolution
in thought. Frege did.“ —Graham Priest
Lecture on Gottlob Frege:
http://www.youtube.com/watch?v=foITiYYu2bc
Dierk König
Canoo
mittie
Dierk König
Canoo
mittie
Please fill the feedback forms

Weitere ähnliche Inhalte

Was ist angesagt?

Pure functions and immutable objects @dev nexus 2021
Pure functions and immutable objects @dev nexus 2021Pure functions and immutable objects @dev nexus 2021
Pure functions and immutable objects @dev nexus 2021Victor Rentea
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!José Paumard
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
AST Transformations
AST TransformationsAST Transformations
AST TransformationsHamletDRC
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Arnaud Giuliani
 
Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Omar Abdelhafith
 
Handling inline assembly in Clang and LLVM
Handling inline assembly in Clang and LLVMHandling inline assembly in Clang and LLVM
Handling inline assembly in Clang and LLVMMin-Yih Hsu
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8Dhaval Dalal
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvmArnaud Giuliani
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional ProgrammingJordan Parmer
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoArnaud Giuliani
 
Clean Code Principles
Clean Code PrinciplesClean Code Principles
Clean Code PrinciplesYeurDreamin'
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Arnaud Giuliani
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Mario Fusco
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersBartosz Kosarzycki
 

Was ist angesagt? (20)

Pure functions and immutable objects @dev nexus 2021
Pure functions and immutable objects @dev nexus 2021Pure functions and immutable objects @dev nexus 2021
Pure functions and immutable objects @dev nexus 2021
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017Kotlin hands on - MorningTech ekito 2017
Kotlin hands on - MorningTech ekito 2017
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Ast transformation
Ast transformationAst transformation
Ast transformation
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)
 
CODEsign 2015
CODEsign 2015CODEsign 2015
CODEsign 2015
 
Handling inline assembly in Clang and LLVM
Handling inline assembly in Clang and LLVMHandling inline assembly in Clang and LLVM
Handling inline assembly in Clang and LLVM
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
 
Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvm
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
 
Kotlin cheat sheet by ekito
Kotlin cheat sheet by ekitoKotlin cheat sheet by ekito
Kotlin cheat sheet by ekito
 
Clean Code Principles
Clean Code PrinciplesClean Code Principles
Clean Code Principles
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 

Andere mochten auch

Software Transactional Memory (STM) in Frege
Software Transactional Memory (STM) in Frege Software Transactional Memory (STM) in Frege
Software Transactional Memory (STM) in Frege Dierk König
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)Dierk König
 
Quick into to Software Transactional Memory in Frege
Quick into to Software Transactional Memory in FregeQuick into to Software Transactional Memory in Frege
Quick into to Software Transactional Memory in FregeDierk König
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholisticoscon2007
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5oscon2007
 
Os Keyshacks
Os KeyshacksOs Keyshacks
Os Keyshacksoscon2007
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss)
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss) FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss)
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss) Dierk König
 
Os Ellistutorial
Os EllistutorialOs Ellistutorial
Os Ellistutorialoscon2007
 
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...Dierk König
 
Os Peytonjones
Os PeytonjonesOs Peytonjones
Os Peytonjonesoscon2007
 
OCaml Labs introduction at OCaml Consortium 2012
OCaml Labs introduction at OCaml Consortium 2012OCaml Labs introduction at OCaml Consortium 2012
OCaml Labs introduction at OCaml Consortium 2012Anil Madhavapeddy
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modelingMario Fusco
 

Andere mochten auch (16)

Software Transactional Memory (STM) in Frege
Software Transactional Memory (STM) in Frege Software Transactional Memory (STM) in Frege
Software Transactional Memory (STM) in Frege
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)
 
Quick into to Software Transactional Memory in Frege
Quick into to Software Transactional Memory in FregeQuick into to Software Transactional Memory in Frege
Quick into to Software Transactional Memory in Frege
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholistic
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5
 
Os Keyshacks
Os KeyshacksOs Keyshacks
Os Keyshacks
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
Os Napier
Os NapierOs Napier
Os Napier
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss)
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss) FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss)
FregeDay: Parallelism in Frege compared to GHC Haskell (Volker Steiss)
 
Os Ellistutorial
Os EllistutorialOs Ellistutorial
Os Ellistutorial
 
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
 
Os Raysmith
Os RaysmithOs Raysmith
Os Raysmith
 
Os Peytonjones
Os PeytonjonesOs Peytonjones
Os Peytonjones
 
OCaml Labs introduction at OCaml Consortium 2012
OCaml Labs introduction at OCaml Consortium 2012OCaml Labs introduction at OCaml Consortium 2012
OCaml Labs introduction at OCaml Consortium 2012
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 

Ähnlich wie Frege - consequently functional programming for the JVM

JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...PROIDEA
 
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanWei-Yuan Chang
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsLeonardo Borges
 
Introduction to julia
Introduction to juliaIntroduction to julia
Introduction to julia岳華 杜
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia岳華 杜
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - StockholmJan Kronquist
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskellujihisa
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testingFoundationDB
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScriptChengHui Weng
 
Zope component architechture
Zope component architechtureZope component architechture
Zope component architechtureAnatoly Bubenkov
 
java 8 Hands on Workshop
java 8 Hands on Workshopjava 8 Hands on Workshop
java 8 Hands on WorkshopJeanne Boyarsky
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the pointseanmcq
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMsunng87
 
ZIO: Powerful and Principled Functional Programming in Scala
ZIO: Powerful and Principled Functional Programming in ScalaZIO: Powerful and Principled Functional Programming in Scala
ZIO: Powerful and Principled Functional Programming in ScalaWiem Zine Elabidine
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Introthnetos
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOWMark Chang
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Qiangning Hong
 

Ähnlich wie Frege - consequently functional programming for the JVM (20)

JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
JDD2015: Frege - Introducing purely functional programming on the JVM - Dierk...
 
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Introduction to julia
Introduction to juliaIntroduction to julia
Introduction to julia
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testing
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Things about Functional JavaScript
Things about Functional JavaScriptThings about Functional JavaScript
Things about Functional JavaScript
 
Zope component architechture
Zope component architechtureZope component architechture
Zope component architechture
 
java 8 Hands on Workshop
java 8 Hands on Workshopjava 8 Hands on Workshop
java 8 Hands on Workshop
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVM
 
ZIO: Powerful and Principled Functional Programming in Scala
ZIO: Powerful and Principled Functional Programming in ScalaZIO: Powerful and Principled Functional Programming in Scala
ZIO: Powerful and Principled Functional Programming in Scala
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 
Python 1
Python 1Python 1
Python 1
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
 

Kürzlich hochgeladen

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 

Kürzlich hochgeladen (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 

Frege - consequently functional programming for the JVM

  • 4. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c
  • 5. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1
  • 6. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2
  • 7. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2
  • 8. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2
  • 9. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2
  • 10. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2
  • 11. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 22 1 2
  • 12. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2 2 1 2
  • 13. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2 2 1 2 state1 state2 state3
  • 14. Why do we care? a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2 2 1 2 time1 time2 time3 state1 state2 state3
  • 15. Operational Reasoning a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2 2 1 2 time1 time2 time3 state1 state2 state3
  • 16. Operational Reasoning a  =  1   b  =  2   c  =  b   b  =  a   a  =  c 1 1 2 1 2 2 1 1 2 2 1 2 time1 time2 time3 state1 state2 state3
  • 17. Using functions a  =  1   b  =  2               1 1 2
  • 18. Using functions a  =  1   b  =  2               1 1 2 2 1 swap(a,b)  =  (b,a)
  • 19. The Key Idea Assignments  change  state  and   introduce  time.   Statements  do  side  effects.   Let’s  just  remove  them!
  • 22. You would not believe just how different it is!
  • 24. Define a Function frege>    times  a  b  =  a  *  b   frege>    times  3  4   12   frege>  :type  times   Num  α  =>  α  -­‐>  α  -­‐>  α
  • 25. Define a Function frege>    times  a  b  =  a  *  b   frege>  (times  3)  4   12   frege>  :type  times   Num  α  =>  α  -­‐>(α  -­‐>  α) no types declared function appl. left associative tell the inferred type typeclass only 1 parameter! return type is a function! thumb: „two params of same numeric type returning that type“ no comma
  • 26. Reference a Function frege>  twotimes  =  times  2   frege>  twotimes  3   6     frege>  :t  twotimes   Int  -­‐>  Int
  • 27. Reference a Function frege>  twotimes  =  times  2   frege>  twotimes  3   6   frege>  :t  twotimes   Int  -­‐>  Int No second argument! „Currying“, „schönfinkeling“, or „partial function application“. Concept invented by Gottlob Frege. inferred types are more specific
  • 28. Function Composition frege>  twotimes  (threetimes  2)   12   frege>  sixtimes  =  twotimes  .  threetimes   frege>  sixtimes  2   frege>  :t  sixtimes   Int  -­‐>  Int
  • 29. Function Composition frege>  twotimes  (threetimes  2)   12   frege>  sixtimes  =  twotimes  .  threetimes   frege>  sixtimes  2   frege>  :t  sixtimes   Int  -­‐>  Int f(g(x)) more about this later (f ° g) (x)
  • 30. Pattern Matching frege>  times  0  (threetimes  2)   0   frege>  times  0  b  =  0
  • 31. Pattern Matching frege>  times  0  (threetimes  2)   0   frege>  times  0  b  =  0 unnecessarily evaluated shortcuttingpattern matching
  • 32. Lazy Evaluation frege>  times  0  (length  [1..])   0 endless sequence evaluation would never stop Pattern matching and non-strict evaluation to the rescue!
  • 33. Pure Functions Java   T  foo(Pair<T,U>  p)  {…}   Frege   foo  ::  (α,β)  -­‐>  α What could possibly happen? What could possibly happen?
  • 34. Pure Functions Java   T  foo(Pair<T,U>  p)  {…}   Frege   foo  ::  (α,β)  -­‐>  α Everything!
 State changes, 
 file or db access, missile launch,… a is returned
  • 35. Pure Functions can  be  cached  (memoized)
 can  be  evaluated  lazily
 can  be  evaluated  in  advance
 can  be  evaluated  concurrently
 can  be  eliminated  
        in  common  subexpressions   can  be  optimized
  • 36. Java Interoperability do not mix OO and FP combine them
  • 37. Java -> Frege Scripting:  JSR  223   Service:
       compile  *.fr  file
       call  static  method simple
  • 38. pure native encode java.net.URLEncoder.encode :: String -> String encode “Dierk König“ 
 native millis java.lang.System.currentTimeMillis :: () -> IO Long millis () millis () past = millis () - 1000 
 Does not compile! Frege -> Java This is a key distinction between Frege and
 other JVM languages! even Java can be pure
  • 39. Frege allows  calling  Java
      but  never  unprotected!   is  explicit  about  effects
      just  like  Haskell  
  • 40. Type System Ubiquitous static typing allows
 global type inference and thus more safety and less work for the programmer You don’t need to specify any types at all! But sometimes you do anyway…
  • 41. Mutable
 I/O Mutable Mutable Keep the mess out! Pure Computation Pure Computation Pure Computation
  • 42. Mutable
 I/O Mutable Mutable Keep the mess out! Pure Computation Pure Computation Pure Computation Ok, these are Monads. Be brave. Think of them as contexts that the type system propagates and makes un-escapable. Thread- safe by design! Checked by compiler
  • 44. Zipping addzip  []  _    =  []
 addzip  _    []  =  []     addzip  (x:xs)  (y:ys)  =  
              (x  +  y  :  addzip  xs  ys  )
  • 45. Zipping addzip  []  _    =  []
 addzip  _    []  =  []     addzip  (x:xs)  (y:ys)  =  
              (x  +  y  :  addzip  xs  ys  )
 
 use as addzip  [1,2,3]                  [1,2,3]            ==  [2,4,6] Pattern matching feels like Prolog Why only for the (+) function? We could be more general…
  • 46. High Order Functions zipWith  f  []  _    =  []
 zipWith  f  _    []  =  []     zipWith  f  (x:xs)  (y:ys)  =  
              (f  x  y  :  zipWith  xs  ys  )  
  • 47. High Order Functions zipWith  f  []  _    =  []
 zipWith  f  _    []  =  []     zipWith  f  (x:xs)  (y:ys)  =  
              (f  x  y  :  zipWith  xs  ys  ) use as zipWith  (+)  [1,2,3]                            [1,2,3]                      ==  [2,4,6]   and, yes we can now define   addzip  =               zipWith  (+)       invented by Gottlob Frege
  • 49. Fizzbuzz Imperative public  class  FizzBuzz{
    public  static  void  main(String[]  args){
        for(int  i=  1;  i  <=  100;  i++){
            if(i  %  15  ==  0{    
                System.out.println(„FizzBuzz");
            }else  if(i  %  3  ==  0){
                System.out.println("Fizz");
            }else  if(i  %  5  ==  0){
                System.out.println("Buzz");
            }else{
                System.out.println(i);
 }  }  }  }
  • 50. Fizzbuzz Logical fizzes      =  cycle      ["",  "",  "fizz"]
 buzzes      =  cycle      ["",  "",  "",  "",  "buzz"]
 pattern    =  zipWith  (++)  fizzes  buzzes   fizzbuzz  =  zipWith  (max  .  show)  pattern  [1..]     main  _      =  do
                      for  (take  100  fizzbuzz)  println
  • 51. Fizzbuzz Comparison Imperative Logical Conditionals 4 0 Operators 7 1 Nesting level 3 0 Sequencing sensitive transparent Maintainability - - - +
  • 52. History Java promise: „No more pointers!“ But NullPointerExceptions (?)
  • 53. Frege is different No More But state no state (unless declared) statements expressions (+ „do“ notation) assignments definitions variables ST monad as „agent“ interfaces type classes classes & objects algebraic data types inheritance parametric polymorphism null references Maybe NullPointerExceptions Bottom, error
  • 55. Frege in comparison safe Java Groovy Frege Haskell concept by 
 Simon Peyton-Jones Frege makes the Haskell spirit accessible to the Java programmer and provides a new level of safety. apply logic run computers practical
  • 56. Why Frege Robustness under parallel execution
 Robustness under composition
 Robustness under increments
 Robustness under refactoring Enables local and equational reasoning Best way to learn FP
  • 58. Gottlob 
 Frege "As I think about acts of integrity and grace, 
 I realise that there is nothing in my knowledge that compares with Frege’s dedication to truth… It was almost superhuman.“ —Bertrand Russel "Not many people managed to create a revolution in thought. Frege did.“ —Graham Priest Lecture on Gottlob Frege: http://www.youtube.com/watch?v=foITiYYu2bc