SlideShare une entreprise Scribd logo
1  sur  116
Télécharger pour lire hors ligne
88

mph
YEAR
2016
GitHub
YEAR
440 BCE
Herodotus
“Herodotus of
Halicarnassus here
presents his research
so that human events
do not fade with
time.”
Herodotus, The Histories

Book I, Proem

trans. Andrea L. Purvis

YEAR
404 BCE
Lysander
“[Sparta] they would never
reduce to slavery a city
which was itself an integral
portion of Hellas, and had
performed a great and
noble service to Hellas in
the most perilous of
emergencies.”
Xenophon, Hellenica

Book 2, 2.20

trans. H. G. Dakyns

YEAR
399 BCE
Socrates
“[Writing offers readers] the
appearance of wisdom, not true
wisdom, for they will read many
things without instruction and
will therefore seem to know
many things, when they are for
the most part ignorant and hard
to get along with, since they are
not wise, but only appear wise.”
Plato, Phaedrus
275a-b

trans. Harold N. Fowler

YEAR
1822
Hegel
“World history is
the record of the
spirit's efforts to
attain knowledge of
what it is in itself.”
Hegel, Lectures on the
Philosophy of World History

Introduction

trans. Johannes Hoffmeister

Timeline
• Local Functions
• Tuples
• Records
• Pattern Matching
• Ref Locals / Ref Returns
• Binary Literals / Digit Separators
Timeline
• Local Functions
• Tuples
• Pattern Matching
Timeline
• Local Functions
• Tuples
• Pattern Matching
YEAR
1960
Algol 60
Local Functions

{Algol 60}
begin
comment classic recursive procedure;
integer nn, nf;
integer procedure factorial(n); value n; integer n;
begin
if n <= 1 then factorial := 1
else factorial := n * factorial(n-1)
end;
nn := 5;
nf := factorial(nn);
outinteger ( 1 , nf)
end
taken from: http://algol60.org/lego/procedure11.a60Algol 60
Local Functions

{Algol 60}
integer procedure factorial(n); value n; integer n;
begin
if n <= 1 then factorial := 1
else factorial := n * factorial(n-1)
end;
nn := 5;
nf := factorial(nn);
taken from: http://algol60.org/lego/procedure11.a60Algol 60
YEAR
2015
C# 6
Local Functions

{without language support}
private struct locals
{
public int x;
}
static void Main(string[] args)
{
var x = 42;
var local = new locals {x = x};
AddOne(ref local);
x = local.x;
WriteLine($"x + 1 = {x}");
}
private static void AddOne(ref locals implicits)
{
implicits.x += 1;
}
C# 6
YEAR
2017
C# 7
Local Functions

{with language support}
static void Main(string[] args)
{
var x = 42;
void AddOne()
{
x += 1;
}
AddOne();
WriteLine($"x + 1 = {x}");
}
C# 7
Functions
Functions

{basic}
function outputinput
Functions

{real world}
function
outputinput
effect
side

effect
Functions

{basic}
Hello Lengthname
Functions

{basic}
public int Hello(string name)
{
var time = DateTime.Now;
Console.Write($"Hello {name} it is now {time}");
return name.Length;
}
C# 6
Functions

{real world}
Hello
Lengthname
DateTime Console
Functions

{real world}
public int Hello(string name)
{
var time = DateTime.Now;
Console.Write($"Hello {name} it is now {time}");
return name.Length;
}
C# 6
YEAR
2017
C# 7
Local Functions

{“realistic”}
static void Main(string[] args)
{
var program = new Program();
IEnumerable<int> values = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
string FormatValues()
{
return string.Join(",", values);
}
Console.WriteLine($"before: {FormatValues()}");
values = program.RealistCode(values);
Console.WriteLine($"after: {FormatValues()}");
}
public IEnumerable<int> RealistCode(IEnumerable<int> values)
{
if (values == null)
throw new ArgumentException("values cannot be null");
if (!values.Any())
throw new ArgumentException("must have at least one element in values");
IEnumerable <int> Rules()
{
return values
.Where(x => x > 2)
.Where(x => x%2 == 1);
}
return Rules();
}
C# 7
Local Functions

{“realistic”}
static void Main(string[] args)
{
var program = new Program();
IEnumerable<int> values = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
string FormatValues()
{
return string.Join(",", values);
}
Console.WriteLine($"before: {FormatValues()}");
values = program.RealistCode(values);
Console.WriteLine($"after: {FormatValues()}");
}
C# 7
Local Functions

{really “realistic”}
public IEnumerable<int> RealistCode(IEnumerable<int> values)
{
if (values == null)
throw new ArgumentException("values cannot be null");
if (!values.Any())
throw new ArgumentException(
"must have at least one element in values");
IEnumerable <int> Rules()
{
return values
.Where(x => x > 2)
.Where(x => x%2 == 1);
}
return Rules();
}
C# 7
Local Functions

{really “realistic”}
public IEnumerable<int> RealistCode(IEnumerable<int> values)
{
Precondition();
return values
.Where(x => x > 2)
.Where(x => x%2 == 1);
void Precondition()
{
if (values == null)
throw new ArgumentException("values cannot be null");
if (!values.Any())
throw new ArgumentException("must have at least one element in values");
}
}
C# 7
Design

By Contract
YEAR
1985
Eiffel
Local Functions

{design by contract}
note
description : "example of factorial"
class
APPLICATION
create
make
feature -- Initialization
make
local
n: NATURAL
do
n := 3
print ("%NFactorial of " + n.out + " = ")
print (recursive_factorial (n))
end
feature -- Access
recursive_factorial (n: NATURAL): NATURAL
require
n >= 0
do
if n = 0 then
Result := 1
else
Result := n * recursive_factorial (n - 1)
end
end
end
Eiffel
Local Functions

{design by contract}
feature -- Access
recursive_factorial (n: NATURAL): NATURAL
require
n >= 0
do
if n = 0 then
Result := 1
else
Result := n * recursive_factorial (n - 1)
end
end
end
Eiffel
YEAR
2009
Clojure
Local Functions

{design by contract}
(ns com.blogspot.comp-phil.factorial)
;; no tail call optimization
(defn factorial [n]
{:pre [((comp not neg?) n)]}
(if (= n 0)
1
(* n (factorial (dec n)))))
(factorial 1)
(factorial 5)
Clojure
Local Functions

{design by contract}
(defn factorial [n]
{:pre [((comp not neg?) n)]}
(if (= n 0)
1
(* n (factorial (dec n)))))
Clojure
YEAR
2017
C# 7
Local Functions

{design by contract}
static void Main(string[] args)
{
// no tail call optimization
long Factorial(int x)
{
if (x < 0)
throw new ArgumentException(“value < 0”);
if (x <= 1) return 1;
return x * Factorial(x-1);
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Tail Call

Optimization
YEAR
2017
C# 7
Local Functions

{no tail call}
static void Main(string[] args)
{
// no tail call optimization
long Factorial(int x)
{
if (x <= 1) return 1;
return x * Factorial(x-1);
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
long Factorial(int x)
{
if (x <= 1) return x;
return x * Factorial(x-1);
}
x = 3

3 * ?
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
long Factorial(int x)
{
if (x <= 1) return x;
return x * Factorial(x-1);
}
x = 3

3 *
x = 2

2 * ?
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
x = 3

3 *
long Factorial(int x)
{
if (x <= 1) return x;
return x * Factorial(x-1);
}
x = 2

2 *
x = 1

1
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
x = 3

3 *
long Factorial(int x)
{
if (x <= 1) return x;
return x * Factorial(x-1);
}
x = 2

2
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
x = 3

6
long Factorial(int x)
{
if (x <= 1) return x;
return x * Factorial(x-1);
}
C# 7
Local Functions

{tail call}
static void Main(string[] args)
{
// would have tail call optimization if supported
long Factorial(int x)
{
long Aux(long acc, int n)
{
if (n <= 1) return acc;
return Aux(acc * n, n - 1);
}
return Aux(1, x);
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 1

n = 3
long Aux(long acc, int n)
{
if (n <= 1) return acc;
return Aux(acc * n, n - 1);
}
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 1

n = 3
acc = 3

n = 2
long Aux(long acc, int n)
{
if (n <= 1) return acc;
return Aux(acc * n, n - 1);
}
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 1

n = 3
acc = 3

n = 2
acc = 6

n = 1
long Aux(long acc, int n)
{
if (n <= 1) return acc;
return Aux(acc * n, n - 1);
}
C# 7
Local Functions

{“tail call optimization”}
static void Main(string[] args)
{
// simulated tail call optimization
long Factorial(int n)
{
long acc = 1;
top:
if (n <= 1) return acc;
acc *= n;
n--;
goto top;
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Local Functions

{“tail call optimization”}
static void Main(string[] args)
{
// simulated tail call optimization
long Factorial(int n)
{
long acc = 1;
top:
if (n <= 1) return acc;
acc *= n;
n--;
goto top;
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 1

n = 3
long Factorial(int n)
{
long acc = 1;
top:
if (n <= 1) return acc;
acc *= n;
n--;
goto top;
}C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 3

n = 2
long Factorial(int n)
{
long acc = 1;
top:
if (n <= 1) return acc;
acc *= n;
n--;
goto top;
}C# 7
Console.WriteLine($"3! = {Factorial(3)}");
acc = 6

n = 1
long Factorial(int n)
{
long acc = 1;
top:
if (n <= 1) return acc;
acc *= n;
n--;
goto top;
}C# 7
YEAR
2010
F#
Local Functions

{tail call optimization}
F#
module Factorial =
let factorial x =
let rec aux m x =
match x with
| 0 -> m
| _ -> aux (m*x) (x-1)
aux 1 x
Timeline
• Local Functions
• Tuples
• Pattern Matching
Tuples
tuple
item 1 item 2
Tuples
“Hello” 42
YEAR
2010
C# 4.0
Tuple

{mostly everything}
static void Main(string[] args)
{
Console.WriteLine("1! = “ + Factorial(1));
Console.WriteLine("5! = “ + Factorial(5));
Console.WriteLine("20! = “ + Factorial(20));
}
private static long Factorial(int x)
{
return FactorialAux(new Tuple<int, int>(1, x));
}
private static long FactorialAux(Tuple<int, int> t)
{
if (t.Item2 <= 1) return t.Item1;
var r = new Tuple<int, int>(t.Item1*t.Item2, t.Item2 - 1);
return FactorialAux(r);
}
C# 4.0
YEAR
2017
C# 7
Tuple

{mostly everything}
static void Main(string[] args)
{
long Factorial(int x)
{
long Aux((int acc, int n) a)
{
if (a.n <= 1) return a.acc;
var r = (a.acc * a.n, a.n - 1);
return Aux(r);
}
(int, int) t = (1, x);
return Aux(t);
}
Console.WriteLine($"1! = {Factorial(1)}");
Console.WriteLine($"3! = {Factorial(3)}");
Console.WriteLine($"20! = {Factorial(20)}");
}
C# 7
Timeline
• Local Functions
• Tuples
• Pattern Matching
Pattern Matching
type 1
type 2
other
type 2 Matcher
YEAR
2010
C# 4.0
Pattern Matching

{types}
static void Main(string[] args)
{
var values = new List<object>
{1, (short) 2,
(Int32) 3, null,
new {}, "no", 1.2d};
foreach (var value in values)
{
var x = value as int;
if (x != null)
Console.WriteLine("got “ + x);
}
}
C# 4.0
YEAR
2017
C# 7
Pattern Matching

{types}
static void Main(string[] args)
{
var values = new List<object>
{1, (short) 2,
(Int32) 3, null,
new {}, "no", 1.2d};
foreach (var value in values)
{
if (value is int x)
Console.WriteLine($"got {x}");
}
}
C# 7
Function

Pattern

Matching
YEAR
1973
ML
Pattern Matching

{functional pattern matching}
fun factorial(0) = 1
| factorial(n) = n * factorial(n-1);
print(
"5! =" ^ (Int.toString (factorial(5))) ^ "n");
ML
YEAR
2004
Scala
Pattern Matching

{functional pattern matching}
import scala.annotation.tailrec
object factorial {
def apply(x: Int): Int = {
@tailrec
def go(m: Int, x: Int): Int = x match {
case 0 => m
case _ => go(x*m, x-1)
}
go(1, x)
}
}
println(s"5! = ${factorial(5)}")
Scala
YEAR
2018
C# 8
Pattern Matching

{functional pattern matching}
long Factorial(int x)
{
long Aux(int m, int x)
{
match(x)
{
case 0: return m;
default: return Aux(x*m, x-1);
}
}
return Aux(1, x);
}
Console.WriteLine($"5! = {Factorial(5)}");
C# 8
YEAR
2018
C# 8
Pattern Matching

{types}
static void Main(string[] args)
{
var values = new List<object>
{1, (short) 2,
(Int32) 3, null,
new {}, "no", 1.2d};
foreach (var value in values)
{
t = match(x)
{
case int _: "int";
case short _: "short";
case object _: "object";
case string _: "string";
default: "something";
}
Console.WriteLine("got “ + t);
}
}
C# 8
Pattern Matching

{types}
foreach (var value in values)
{
t = match(x)
{
case int _: "int";
case short _: "short";
case object _: "object";
case string _: "string";
default: "something";
}
Console.WriteLine("got “ + t);
}
C# 8
Thank you!
Mike Harris



@MikeMKH

http://comp-phil.blogspot.com/
Biography
• Tomas Petricek - "Coeffects: Context-aware programming
languages" http://tomasp.net/coeffects/
• https://github.com/dotnet/roslyn/blob/features/patterns/
docs/features/local-functions.md
• https://github.com/dotnet/roslyn/issues/347
• https://github.com/dotnet/roslyn/blob/features/patterns/
docs/features/patterns.md
• https://github.com/dotnet/roslyn/blob/master/docs/
Language%20Feature%20Status.md
Images
• DeLorean DMC-12 by en:user:Grenex - Wikipedia en, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=2500249
• Herodotos by © Marie-Lan Nguyen / Wikimedia Commons, Public
Domain, https://commons.wikimedia.org/w/index.php?curid=12886457
• Lysander by Walter Crane - The story of Greece : told to boys and girls
(191-?) by Macgregor, Mary, Public Domain, https://
commons.wikimedia.org/w/index.php?curid=32804563
• Socrates by Walter Crane - The story of Greece : told to boys and girls
(191-?) by Macgregor, Mary, Public Domain, https://
commons.wikimedia.org/w/index.php?curid=32804549
• Hegel by Unknown - http://portrait.kaar.at/, Public Domain, https://
commons.wikimedia.org/w/index.php?curid=3308762

Contenu connexe

Tendances

TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...tdc-globalcode
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBtdc-globalcode
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Datagreenwop
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей КоваленкоFwdays
 
Haskell in the Real World
Haskell in the Real WorldHaskell in the Real World
Haskell in the Real Worldosfameron
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в JavaDEVTYPE
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewPaulo Morgado
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeKevlin Henney
 
Talk - Query monad
Talk - Query monad Talk - Query monad
Talk - Query monad Fabernovel
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Chris Richardson
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScriptGarth Gilmour
 

Tendances (20)

Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
 
Haskell in the Real World
Haskell in the Real WorldHaskell in the Real World
Haskell in the Real World
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
 
PDBC
PDBCPDBC
PDBC
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative Practice
 
Talk - Query monad
Talk - Query monad Talk - Query monad
Talk - Query monad
 
Sneaking inside Kotlin features
Sneaking inside Kotlin featuresSneaking inside Kotlin features
Sneaking inside Kotlin features
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 

En vedette

The Little Wonders of C# 6
The Little Wonders of C# 6The Little Wonders of C# 6
The Little Wonders of C# 6BlackRabbitCoder
 
What's new in c# 6
What's new in c# 6What's new in c# 6
What's new in c# 6Amir Barylko
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Jacinto Limjap
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developerMichael Kennedy
 
Automating C# Coding Standards using StyleCop and FxCop
Automating C# Coding Standards using StyleCop and FxCopAutomating C# Coding Standards using StyleCop and FxCop
Automating C# Coding Standards using StyleCop and FxCopBlackRabbitCoder
 
More Little Wonders of C#/.NET
More Little Wonders of C#/.NETMore Little Wonders of C#/.NET
More Little Wonders of C#/.NETBlackRabbitCoder
 
C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageJacinto Limjap
 
C# features through examples
C# features through examplesC# features through examples
C# features through examplesZayen Chagra
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegantalenttransform
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scalapt114
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsAniruddha Chakrabarti
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NETDror Helper
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core ConceptsFabio Biondi
 
Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Fwdays
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practicesTan Tran
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringEyob Lube
 

En vedette (20)

The Little Wonders of C# 6
The Little Wonders of C# 6The Little Wonders of C# 6
The Little Wonders of C# 6
 
What's new in c# 6
What's new in c# 6What's new in c# 6
What's new in c# 6
 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
 
C# 7
C# 7C# 7
C# 7
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developer
 
Automating C# Coding Standards using StyleCop and FxCop
Automating C# Coding Standards using StyleCop and FxCopAutomating C# Coding Standards using StyleCop and FxCop
Automating C# Coding Standards using StyleCop and FxCop
 
More Little Wonders of C#/.NET
More Little Wonders of C#/.NETMore Little Wonders of C#/.NET
More Little Wonders of C#/.NET
 
C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming Language
 
C# features through examples
C# features through examplesC# features through examples
C# features through examples
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegan
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scala
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows Platforms
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"Игорь Фесенко "What’s New in C# 7.0"
Игорь Фесенко "What’s New in C# 7.0"
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practices
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoring
 

Similaire à C# 7

Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607Kevin Hazzard
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in goYusuke Kita
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016DesertJames
 
Roslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesRoslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesMichael Step
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsBartosz Kosarzycki
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
 
Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»SpbDotNet Community
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchainedEduard Tomàs
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already KnowKevlin Henney
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageDroidConTLV
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
Lecture 5: Functional Programming
Lecture 5: Functional ProgrammingLecture 5: Functional Programming
Lecture 5: Functional ProgrammingEelco Visser
 
Reactive Programming Patterns with RxSwift
Reactive Programming Patterns with RxSwiftReactive Programming Patterns with RxSwift
Reactive Programming Patterns with RxSwiftFlorent Pillet
 
Monadologie
MonadologieMonadologie
Monadologieleague
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsEelco Visser
 

Similaire à C# 7 (20)

Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in go
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016
 
Roslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesRoslyn and C# 6.0 New Features
Roslyn and C# 6.0 New Features
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
 
Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already Know
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritage
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Javascript
JavascriptJavascript
Javascript
 
Effective Object Oriented Design in Cpp
Effective Object Oriented Design in CppEffective Object Oriented Design in Cpp
Effective Object Oriented Design in Cpp
 
Lecture 5: Functional Programming
Lecture 5: Functional ProgrammingLecture 5: Functional Programming
Lecture 5: Functional Programming
 
Reactive Programming Patterns with RxSwift
Reactive Programming Patterns with RxSwiftReactive Programming Patterns with RxSwift
Reactive Programming Patterns with RxSwift
 
Monadologie
MonadologieMonadologie
Monadologie
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
 

Plus de Mike Harris

A Divine Data Comedy
A Divine Data ComedyA Divine Data Comedy
A Divine Data ComedyMike Harris
 
Combinators - Lightning Talk
Combinators - Lightning TalkCombinators - Lightning Talk
Combinators - Lightning TalkMike Harris
 
Hiking through the Functional Forest with Fizz Buzz
Hiking through the Functional Forest with Fizz BuzzHiking through the Functional Forest with Fizz Buzz
Hiking through the Functional Forest with Fizz BuzzMike Harris
 
All You Need is Fold in the Key of C#
All You Need is Fold in the Key of C#All You Need is Fold in the Key of C#
All You Need is Fold in the Key of C#Mike Harris
 
All You Need is Fold
All You Need is FoldAll You Need is Fold
All You Need is FoldMike Harris
 
There and Back Again
There and Back AgainThere and Back Again
There and Back AgainMike Harris
 
The Marvelous Land of Higher Order Functions
The Marvelous Land of Higher Order FunctionsThe Marvelous Land of Higher Order Functions
The Marvelous Land of Higher Order FunctionsMike Harris
 
Testing the Next Generation
Testing the Next GenerationTesting the Next Generation
Testing the Next GenerationMike Harris
 
Learn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodLearn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodMike Harris
 

Plus de Mike Harris (10)

A Divine Data Comedy
A Divine Data ComedyA Divine Data Comedy
A Divine Data Comedy
 
Combinators - Lightning Talk
Combinators - Lightning TalkCombinators - Lightning Talk
Combinators - Lightning Talk
 
Hiking through the Functional Forest with Fizz Buzz
Hiking through the Functional Forest with Fizz BuzzHiking through the Functional Forest with Fizz Buzz
Hiking through the Functional Forest with Fizz Buzz
 
Coding f#un
Coding f#unCoding f#un
Coding f#un
 
All You Need is Fold in the Key of C#
All You Need is Fold in the Key of C#All You Need is Fold in the Key of C#
All You Need is Fold in the Key of C#
 
All You Need is Fold
All You Need is FoldAll You Need is Fold
All You Need is Fold
 
There and Back Again
There and Back AgainThere and Back Again
There and Back Again
 
The Marvelous Land of Higher Order Functions
The Marvelous Land of Higher Order FunctionsThe Marvelous Land of Higher Order Functions
The Marvelous Land of Higher Order Functions
 
Testing the Next Generation
Testing the Next GenerationTesting the Next Generation
Testing the Next Generation
 
Learn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great GoodLearn You a Functional JavaScript for Great Good
Learn You a Functional JavaScript for Great Good
 

Dernier

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Dernier (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

C# 7

  • 1.
  • 2.
  • 4.
  • 6.
  • 7.
  • 9. “Herodotus of Halicarnassus here presents his research so that human events do not fade with time.” Herodotus, The Histories
 Book I, Proem
 trans. Andrea L. Purvis

  • 10.
  • 12. “[Sparta] they would never reduce to slavery a city which was itself an integral portion of Hellas, and had performed a great and noble service to Hellas in the most perilous of emergencies.” Xenophon, Hellenica
 Book 2, 2.20
 trans. H. G. Dakyns

  • 13.
  • 15. “[Writing offers readers] the appearance of wisdom, not true wisdom, for they will read many things without instruction and will therefore seem to know many things, when they are for the most part ignorant and hard to get along with, since they are not wise, but only appear wise.” Plato, Phaedrus 275a-b
 trans. Harold N. Fowler

  • 16.
  • 18. “World history is the record of the spirit's efforts to attain knowledge of what it is in itself.” Hegel, Lectures on the Philosophy of World History
 Introduction
 trans. Johannes Hoffmeister

  • 19.
  • 20. Timeline • Local Functions • Tuples • Records • Pattern Matching • Ref Locals / Ref Returns • Binary Literals / Digit Separators
  • 21. Timeline • Local Functions • Tuples • Pattern Matching
  • 22.
  • 23. Timeline • Local Functions • Tuples • Pattern Matching
  • 24.
  • 26. Local Functions
 {Algol 60} begin comment classic recursive procedure; integer nn, nf; integer procedure factorial(n); value n; integer n; begin if n <= 1 then factorial := 1 else factorial := n * factorial(n-1) end; nn := 5; nf := factorial(nn); outinteger ( 1 , nf) end taken from: http://algol60.org/lego/procedure11.a60Algol 60
  • 27. Local Functions
 {Algol 60} integer procedure factorial(n); value n; integer n; begin if n <= 1 then factorial := 1 else factorial := n * factorial(n-1) end; nn := 5; nf := factorial(nn); taken from: http://algol60.org/lego/procedure11.a60Algol 60
  • 28.
  • 30. Local Functions
 {without language support} private struct locals { public int x; } static void Main(string[] args) { var x = 42; var local = new locals {x = x}; AddOne(ref local); x = local.x; WriteLine($"x + 1 = {x}"); } private static void AddOne(ref locals implicits) { implicits.x += 1; } C# 6
  • 31.
  • 33. Local Functions
 {with language support} static void Main(string[] args) { var x = 42; void AddOne() { x += 1; } AddOne(); WriteLine($"x + 1 = {x}"); } C# 7
  • 38. Functions
 {basic} public int Hello(string name) { var time = DateTime.Now; Console.Write($"Hello {name} it is now {time}"); return name.Length; } C# 6
  • 40. Functions
 {real world} public int Hello(string name) { var time = DateTime.Now; Console.Write($"Hello {name} it is now {time}"); return name.Length; } C# 6
  • 41.
  • 43. Local Functions
 {“realistic”} static void Main(string[] args) { var program = new Program(); IEnumerable<int> values = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; string FormatValues() { return string.Join(",", values); } Console.WriteLine($"before: {FormatValues()}"); values = program.RealistCode(values); Console.WriteLine($"after: {FormatValues()}"); } public IEnumerable<int> RealistCode(IEnumerable<int> values) { if (values == null) throw new ArgumentException("values cannot be null"); if (!values.Any()) throw new ArgumentException("must have at least one element in values"); IEnumerable <int> Rules() { return values .Where(x => x > 2) .Where(x => x%2 == 1); } return Rules(); } C# 7
  • 44. Local Functions
 {“realistic”} static void Main(string[] args) { var program = new Program(); IEnumerable<int> values = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; string FormatValues() { return string.Join(",", values); } Console.WriteLine($"before: {FormatValues()}"); values = program.RealistCode(values); Console.WriteLine($"after: {FormatValues()}"); } C# 7
  • 45. Local Functions
 {really “realistic”} public IEnumerable<int> RealistCode(IEnumerable<int> values) { if (values == null) throw new ArgumentException("values cannot be null"); if (!values.Any()) throw new ArgumentException( "must have at least one element in values"); IEnumerable <int> Rules() { return values .Where(x => x > 2) .Where(x => x%2 == 1); } return Rules(); } C# 7
  • 46. Local Functions
 {really “realistic”} public IEnumerable<int> RealistCode(IEnumerable<int> values) { Precondition(); return values .Where(x => x > 2) .Where(x => x%2 == 1); void Precondition() { if (values == null) throw new ArgumentException("values cannot be null"); if (!values.Any()) throw new ArgumentException("must have at least one element in values"); } } C# 7
  • 49. Local Functions
 {design by contract} note description : "example of factorial" class APPLICATION create make feature -- Initialization make local n: NATURAL do n := 3 print ("%NFactorial of " + n.out + " = ") print (recursive_factorial (n)) end feature -- Access recursive_factorial (n: NATURAL): NATURAL require n >= 0 do if n = 0 then Result := 1 else Result := n * recursive_factorial (n - 1) end end end Eiffel
  • 50. Local Functions
 {design by contract} feature -- Access recursive_factorial (n: NATURAL): NATURAL require n >= 0 do if n = 0 then Result := 1 else Result := n * recursive_factorial (n - 1) end end end Eiffel
  • 51.
  • 53. Local Functions
 {design by contract} (ns com.blogspot.comp-phil.factorial) ;; no tail call optimization (defn factorial [n] {:pre [((comp not neg?) n)]} (if (= n 0) 1 (* n (factorial (dec n))))) (factorial 1) (factorial 5) Clojure
  • 54. Local Functions
 {design by contract} (defn factorial [n] {:pre [((comp not neg?) n)]} (if (= n 0) 1 (* n (factorial (dec n))))) Clojure
  • 55.
  • 57. Local Functions
 {design by contract} static void Main(string[] args) { // no tail call optimization long Factorial(int x) { if (x < 0) throw new ArgumentException(“value < 0”); if (x <= 1) return 1; return x * Factorial(x-1); } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 60. Local Functions
 {no tail call} static void Main(string[] args) { // no tail call optimization long Factorial(int x) { if (x <= 1) return 1; return x * Factorial(x-1); } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 61. Console.WriteLine($"3! = {Factorial(3)}"); long Factorial(int x) { if (x <= 1) return x; return x * Factorial(x-1); } x = 3
 3 * ? C# 7
  • 62. Console.WriteLine($"3! = {Factorial(3)}"); long Factorial(int x) { if (x <= 1) return x; return x * Factorial(x-1); } x = 3
 3 * x = 2
 2 * ? C# 7
  • 63. Console.WriteLine($"3! = {Factorial(3)}"); x = 3
 3 * long Factorial(int x) { if (x <= 1) return x; return x * Factorial(x-1); } x = 2
 2 * x = 1
 1 C# 7
  • 64. Console.WriteLine($"3! = {Factorial(3)}"); x = 3
 3 * long Factorial(int x) { if (x <= 1) return x; return x * Factorial(x-1); } x = 2
 2 C# 7
  • 65. Console.WriteLine($"3! = {Factorial(3)}"); x = 3
 6 long Factorial(int x) { if (x <= 1) return x; return x * Factorial(x-1); } C# 7
  • 66.
  • 67. Local Functions
 {tail call} static void Main(string[] args) { // would have tail call optimization if supported long Factorial(int x) { long Aux(long acc, int n) { if (n <= 1) return acc; return Aux(acc * n, n - 1); } return Aux(1, x); } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 68. Console.WriteLine($"3! = {Factorial(3)}"); acc = 1
 n = 3 long Aux(long acc, int n) { if (n <= 1) return acc; return Aux(acc * n, n - 1); } C# 7
  • 69. Console.WriteLine($"3! = {Factorial(3)}"); acc = 1
 n = 3 acc = 3
 n = 2 long Aux(long acc, int n) { if (n <= 1) return acc; return Aux(acc * n, n - 1); } C# 7
  • 70. Console.WriteLine($"3! = {Factorial(3)}"); acc = 1
 n = 3 acc = 3
 n = 2 acc = 6
 n = 1 long Aux(long acc, int n) { if (n <= 1) return acc; return Aux(acc * n, n - 1); } C# 7
  • 71.
  • 72. Local Functions
 {“tail call optimization”} static void Main(string[] args) { // simulated tail call optimization long Factorial(int n) { long acc = 1; top: if (n <= 1) return acc; acc *= n; n--; goto top; } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 73. Local Functions
 {“tail call optimization”} static void Main(string[] args) { // simulated tail call optimization long Factorial(int n) { long acc = 1; top: if (n <= 1) return acc; acc *= n; n--; goto top; } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 74. Console.WriteLine($"3! = {Factorial(3)}"); acc = 1
 n = 3 long Factorial(int n) { long acc = 1; top: if (n <= 1) return acc; acc *= n; n--; goto top; }C# 7
  • 75. Console.WriteLine($"3! = {Factorial(3)}"); acc = 3
 n = 2 long Factorial(int n) { long acc = 1; top: if (n <= 1) return acc; acc *= n; n--; goto top; }C# 7
  • 76. Console.WriteLine($"3! = {Factorial(3)}"); acc = 6
 n = 1 long Factorial(int n) { long acc = 1; top: if (n <= 1) return acc; acc *= n; n--; goto top; }C# 7
  • 77.
  • 79. Local Functions
 {tail call optimization} F# module Factorial = let factorial x = let rec aux m x = match x with | 0 -> m | _ -> aux (m*x) (x-1) aux 1 x
  • 80.
  • 81. Timeline • Local Functions • Tuples • Pattern Matching
  • 84.
  • 86. Tuple
 {mostly everything} static void Main(string[] args) { Console.WriteLine("1! = “ + Factorial(1)); Console.WriteLine("5! = “ + Factorial(5)); Console.WriteLine("20! = “ + Factorial(20)); } private static long Factorial(int x) { return FactorialAux(new Tuple<int, int>(1, x)); } private static long FactorialAux(Tuple<int, int> t) { if (t.Item2 <= 1) return t.Item1; var r = new Tuple<int, int>(t.Item1*t.Item2, t.Item2 - 1); return FactorialAux(r); } C# 4.0
  • 87.
  • 89. Tuple
 {mostly everything} static void Main(string[] args) { long Factorial(int x) { long Aux((int acc, int n) a) { if (a.n <= 1) return a.acc; var r = (a.acc * a.n, a.n - 1); return Aux(r); } (int, int) t = (1, x); return Aux(t); } Console.WriteLine($"1! = {Factorial(1)}"); Console.WriteLine($"3! = {Factorial(3)}"); Console.WriteLine($"20! = {Factorial(20)}"); } C# 7
  • 90.
  • 91. Timeline • Local Functions • Tuples • Pattern Matching
  • 92. Pattern Matching type 1 type 2 other type 2 Matcher
  • 93.
  • 95. Pattern Matching
 {types} static void Main(string[] args) { var values = new List<object> {1, (short) 2, (Int32) 3, null, new {}, "no", 1.2d}; foreach (var value in values) { var x = value as int; if (x != null) Console.WriteLine("got “ + x); } } C# 4.0
  • 96.
  • 98. Pattern Matching
 {types} static void Main(string[] args) { var values = new List<object> {1, (short) 2, (Int32) 3, null, new {}, "no", 1.2d}; foreach (var value in values) { if (value is int x) Console.WriteLine($"got {x}"); } } C# 7
  • 101. Pattern Matching
 {functional pattern matching} fun factorial(0) = 1 | factorial(n) = n * factorial(n-1); print( "5! =" ^ (Int.toString (factorial(5))) ^ "n"); ML
  • 102.
  • 104. Pattern Matching
 {functional pattern matching} import scala.annotation.tailrec object factorial { def apply(x: Int): Int = { @tailrec def go(m: Int, x: Int): Int = x match { case 0 => m case _ => go(x*m, x-1) } go(1, x) } } println(s"5! = ${factorial(5)}") Scala
  • 105.
  • 107. Pattern Matching
 {functional pattern matching} long Factorial(int x) { long Aux(int m, int x) { match(x) { case 0: return m; default: return Aux(x*m, x-1); } } return Aux(1, x); } Console.WriteLine($"5! = {Factorial(5)}"); C# 8
  • 108.
  • 110. Pattern Matching
 {types} static void Main(string[] args) { var values = new List<object> {1, (short) 2, (Int32) 3, null, new {}, "no", 1.2d}; foreach (var value in values) { t = match(x) { case int _: "int"; case short _: "short"; case object _: "object"; case string _: "string"; default: "something"; } Console.WriteLine("got “ + t); } } C# 8
  • 111. Pattern Matching
 {types} foreach (var value in values) { t = match(x) { case int _: "int"; case short _: "short"; case object _: "object"; case string _: "string"; default: "something"; } Console.WriteLine("got “ + t); } C# 8
  • 112.
  • 114.
  • 115. Biography • Tomas Petricek - "Coeffects: Context-aware programming languages" http://tomasp.net/coeffects/ • https://github.com/dotnet/roslyn/blob/features/patterns/ docs/features/local-functions.md • https://github.com/dotnet/roslyn/issues/347 • https://github.com/dotnet/roslyn/blob/features/patterns/ docs/features/patterns.md • https://github.com/dotnet/roslyn/blob/master/docs/ Language%20Feature%20Status.md
  • 116. Images • DeLorean DMC-12 by en:user:Grenex - Wikipedia en, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=2500249 • Herodotos by © Marie-Lan Nguyen / Wikimedia Commons, Public Domain, https://commons.wikimedia.org/w/index.php?curid=12886457 • Lysander by Walter Crane - The story of Greece : told to boys and girls (191-?) by Macgregor, Mary, Public Domain, https:// commons.wikimedia.org/w/index.php?curid=32804563 • Socrates by Walter Crane - The story of Greece : told to boys and girls (191-?) by Macgregor, Mary, Public Domain, https:// commons.wikimedia.org/w/index.php?curid=32804549 • Hegel by Unknown - http://portrait.kaar.at/, Public Domain, https:// commons.wikimedia.org/w/index.php?curid=3308762