Download presentation

Presentation is loading. Please wait.

Published byEric Wells Modified over 2 years ago

1
Haskell Chapter 1, Part I

2
Why are we doing this? http://stackoverflow.com/questions/3175656/why-should- i-want-to-learn-haskell http://stackoverflow.com/questions/3175656/why-should- i-want-to-learn-haskell http://programmers.stackexchange.com/questions/25569/i s-haskell-worth-learning http://programmers.stackexchange.com/questions/25569/i s-haskell-worth-learning

3
Why study functional languages? Without understanding functional programming, you can’t invent MapReduce, the algorithm that makes Google so massively scalable. —Joel Spolsky, The Perils of Java Schools

4
Perspective http://www.defmacro.org/ramblings/fp.html http://www.defmacro.org/ramblings/fp.html This is where the story would stop, I'd wrap up the article, and you'd navigate to another page, if not for the beginning of World War II. The world was in flames. The U.S. Army and Navy used artillery more often than ever. In attempts to improve accuracy the Army employed a large group of mathematicians to continuously calculate differential equations required for solving ballistic firing tables. It was becoming obvious that the task was too great for being solved manually and various equipment was developed in order to overcome this problem.

5
Theory of Computation Independently of Alonzo Church, Alan Turing was performing similar work. He developed a different formalism (now referred to as the Turing machine), and used it to independently come to similar conclusions as Alonzo. Later it was shown that Turing machines and lambda calculus were equivalent in power. http://www.defmacro.org/ramblings/fp.html

6
Why FP? In general, use the language in which it's easiest to express the solution to a problem. For functional programming, this is when the solution to a problem is easily expressed in terms of functions, hence the name. Generally it's good for mathematical operations, AI, pattern matching; in general anything that can be broken down into a set of rules that must be applied to get an answer. You can only really determine the "best" language to use after you've analyzed your problem sufficiently. This is where pseudo-code comes in handy. If you find yourself writing pseudo-code that looks like FP, use FP.

7
AI I started working through the book Artificial Intelligence: A Modern Approach by Russell and Norvig and implementing the algorithms in Haskell. You can see the code … but it's a demonstration that you can write AI code in Haskell without much trouble. Some things I learned in the course of doing this: Haskell is excellent at creating domain specific languages, which made writing the logical reasoning modules (propositional and first order logic solvers) very easy. Compare it to the 'official' implementation in Python and you'll see that the Haskell version is much more understandable. The fact that probability distributions form a monad greatly simplify any code that has to deal with probabilistic effects. Being able to separate pure actions from I/O is a huge boon. It enabled me to write algorithms like graph search, alpha/beta search and constraint propagation without thinking about how the user would have to interact with them, and only later add in the I/O routines. http://www.reddit.com/r/haskell/comments/10nast/is_haskell_a_good_language_to_develop_artificial/

8
Pattern Matching Domain specific languages Compilers Data transformations Today, pattern matching is found in almost all functional languages including OCaml, F#, Scala, Haskell, Clojure and Erlang. For example, I recently built a bespoke business rules engine for a client with a focus on mathematics. That is 1,000 lines of F# and is predominantly an interpreter. Lexing, parsing, type checking and interpreting input are all much easier thanks to pattern matching. Lexing IS pattern matching… http://stackoverflow.com/questions/397425/when-to-use-a-functional-programming-language

9
Haskell http://www.haskell.org/haskellwiki/Haskell_Communities_ and_Activities_Report http://www.haskell.org/haskellwiki/Haskell_Communities_ and_Activities_Report Pretty print -> parser Parse epub3 metadata Auto-completion DSL for generating JavaScript (Sunroof) Computation (automatic differentiation, numeric integration, bifunctors, etc.) Chordify – extract chords from music sources

10
Real-world FP - F# http://homepages.inf.ed.ac.uk/wadler/realworld/ http://homepages.inf.ed.ac.uk/wadler/realworld/ Using F# to develop quantitative models for financial products Grange Insurance parallelized its rating engine to take better advantage of multicore server hardware For a machine learning scientist, speed of experimentation is the critical factor to optimize. We see great potential for F# to be used as a scripting language in CAD; it fits very well for computational design challenges in the construction industry. F# encourages Reason Driven Development that leads to virtually bug-free code (Fixed Income securities trading optimization.)

11
More real-world FP (not just F#) Syntax Tools Theorem Provers and Reasoning Assistants Network Toolkits and Applications (e.g., Gopher, FTP) Natural Language Processing and Speech Recognition Web, HTML, XML Database Systems Games and Novelties

Similar presentations

OK

CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.

CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on diffusion in daily life Ppt on holographic technology companies Ppt on industrialisation and social change Ppt online examination project in php Ppt on limits and continuity review Ppt on perimeter and area of circle Ppt on gujarati culture Ppt on word association test words Ppt on total parenteral nutrition guidelines Ppt on sf6 gas circuit breaker