De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

Programmeren met Algebra André van Delft 6 februari 2012 Presentatie op Grotius College Delft.

Verwante presentaties


Presentatie over: "Programmeren met Algebra André van Delft 6 februari 2012 Presentatie op Grotius College Delft."— Transcript van de presentatie:

1 Programmeren met Algebra André van Delft 6 februari 2012 Presentatie op Grotius College Delft

2 CV 1979-1985Studie Wiskunde in Leiden 1982-1985Studie Bedrijfskunde in Delft/Rotterdam 1985-1989Promotieplaats Informatica in Leiden 1989-2006Software-ontwikkelaar op contractbasis 2006-2012Wetenschapper bij NATO/NC3A Onderzoek & Ontwikkeling van Programmeertalen – Parallelisme – Grootheden & Eenheden – Rare talen

3 Alan Kay

4 Programmeren moeilijk sinds 1995 Meerdere taken tegelijk:threading – HoofdtaakMain thread – Langdurige takenBackground thread – SchermafhandelingGUI thread Gebeurtenissen (event handling) & communicatie – Toetsenbord, muis, touch screen – GPS, sensoren – Internet, Bluetooth Programmeertalen: C  C++  Java, C#  Scala Geen oplossing…

5 GUI-applicatie - 1 Invoerveld Zoekknop Zoeken… Resultaten

6 GUI-applicatie - 2 val searchButton = new Button("Go”) { reactions.+= { case ButtonClicked(b) => enabled = false outputTA.text = "Starting search...” new Thread(new Runnable { def run() { Thread.sleep(3000) SwingUtilities.invokeLater(new Runnable{ def run() {outputTA.text="Search ready” enabled = true }}) }}).start }

7 GUI-applicatie - 3 live = searchSequence... searchSequence = searchCommand showSearchingText searchInDatabase showSearchResults searchCommand = searchButton showSearchingText = @gui: {outputTA.text = "…"} showSearchResults = @gui: {outputTA.text = "…"} searchInDatabase = {* Thread.sleep(3000) *}

8 GUI-applicatie - 4 Zoeken:knop of Enter-toets Afbreken:knop of Escape-toets Exit:knop of ; daarna: “Are you sure?”… Alleen zoeken als tekstveld gevuld is Voortgang tonen

9 GUI-applicatie - 5 searchGuard = if(!searchTF.text.isEmpty). anyEvent(comp)... searchInDatabase = {*Thread.sleep(3000)*} || progressMonitor progressMonitor = {*Thread.sleep( 250)*} @gui:{searchTF.text+=here.pass}... live = searchSequence... || exit searchCommand = searchButton + Key.Enter cancelCommand = cancelButton + Key.Escape exitCommand = exitButton + windowClosing exit = exitCommand @gui: while(!areYouSure) cancelSearch = cancelCommand @gui: showCanceledText searchSequence = searchGuard searchCommand; showSearchingText searchInDatabase showSearchResults / cancelSearch

10 Process Algebra Wiskundige theorie over processen Bergstra&Klop, Amsterdam, 1982 x y = x y + y x + x|y x+y = y+x (x+y)+z = x+(y+z) x+x = x (x+y)·z = x·z+y·z (x·y)·z = x·(y·z) O+x = x O·x = O 1·x = x x·1 = x δ+x = x δ·x = δ ε·x = x x·ε = x (x+ε)·y = x·y + ε·y = x·y + y

11 Werking: Templates & Call Graphs {Hello}+ε; {World} (x+ε)·y = x·y + ε·y = x·y + y

12 Slot Eenvoudig en efficiënt Nu 2000 regels Scala Nog veel te doen en te ontdekken Open Source: http://code.google.com/p/subscript/ http://code.google.com/p/subscript/ www.rosettacode.org … www.rosettacode.org

13

14

15 Hello World http://rosettacode.org/wiki/Hello_world/Text C: #include int main(void) { printf(”Hello, World!\n”); return 0; } HQ9+: H C0H: C1R: Hello_world/Text

16 100 Doors http://rosettacode.org/wiki/100_doors C: #include int main() { int door, square, increment; for (door = 1, square = 1, increment = 1; door <= 100; door++ == square && (square += increment += 2)) printf("door #%d is %s.\n", door, (door == square? "open" : "closed")); return 0; } C1R: 100_doors Stupid This means that nearly every C1R "solution" in Rosetta is simply a heading, followed by string which gives the path name to the C solution. This is a form of redundancy that is effectively spam. David St. Hubbins: It's such a fine line between stupid, and uh... Nigel Tufnel: Clever. David St. Hubbins: Yeah, and clever.

17 Zeef van Eratosthenes - 1

18 Zeef van Eratosthenes - 2 main = generator(2,1000000) ==> (..==>sieve) =={toPrint}==> printer generator(s,e) = for(i<-s to e) <=i sieve = =>p:Int? @toPrint:<=p;..=>i:Int? if (i%p!=0) <=i printer =..=>i:Int? println,i (i:Int) = {}


Download ppt "Programmeren met Algebra André van Delft 6 februari 2012 Presentatie op Grotius College Delft."

Verwante presentaties


Ads door Google