Haskell Chapter 1, Part I.

Slides:



Advertisements
Similar presentations
Copyright 2001, ActiveState. XSLT and Scripting Languages or…XSLT: what is everyone so hot and bothered about?
Advertisements

Haskell Chapter 1, Part I. Why are we doing this?  i-want-to-learn-haskell
1.Data categorization 2.Information 3.Knowledge 4.Wisdom 5.Social understanding Which of the following requires a firm to expend resources to organize.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
Data Structures Introduction. What is data? (Latin) Plural of datum = something given.
CS 290C: Formal Models for Web Software Lecture 1: Introduction Instructor: Tevfik Bultan.
InterLink William R. Cook UT Austin November 2008.
Mgt 240 Lecture Website Construction: Software and Language Alternatives March 29, 2005.
Semantic Web Technologies Lecture # 2 Faculty of Computer Science, IBA.
Computer Programming My Home Page My Paper Job Description Computer programmers write, test, and maintain the detailed instructions, called programs,
Chapter 14: Artificial Intelligence Invitation to Computer Science, C++ Version, Third Edition.
Knowledge representation
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Artificial Intelligence Introductory Lecture Jennifer J. Burg Department of Mathematics and Computer Science.
How Solvable Is Intelligence? A brief introduction to AI Dr. Richard Fox Department of Computer Science Northern Kentucky University.
240-Current Research Easily Extensible Systems, Octave, Input Formats, SOA.
Chapter 4 Decision Support System & Artificial Intelligence.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
1 CS145 Lecture 24 What’s next?. 2  What questions does Computer Science study?  Where is programming and Computer Science headed? –With special emphasis.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
A Portrait of the Semantic Web in Action Jeff Heflin and James Hendler IEEE Intelligent Systems December 6, 2010 Hyewon Lim.
CS223: Software Engineering
Navigation Framework using CF Architecture for a Client-Server Application using the open standards of the Web presented by Kedar Desai Differential Technologies,
Artificial Intelligence
Sub-fields of computer science. Sub-fields of computer science.
Chapter 1. Introduction.
Mathematical Foundations
Computer Science skill sets
COMP Compilers Lecture 1: Introduction
Teaching Compiler Design
Python Programming Unit -1.
IBM Predictive Analytics Virtual Users’ Group Meeting March 30, 2016
The language focusses on ease of use
Chapter 1 Introduction.
Programming Languages Dan Grossman 2013
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Artificial intelligence (AI)
CHAPTER 1 Introduction BIC 3337 EXPERT SYSTEM.
PERL.
Introduction Characteristics Advantages Limitations
Done Done Course Overview What is AI? What are the Major Challenges?
CS101 Introduction to Computing Lecture 19 Programming Languages
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
CISC 7120X Programming Languages and Compilers
Introduction CSE 1310 – Introduction to Computers and Programming
Overview of the Course Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University.
Developing Applications
Introduction to programming languages, Algorithms & flowcharts
Prepared by Lee Revere and John Large
MANAGING KNOWLEDGE FOR THE DIGITAL FIRM
Artificial Intelligence
Course Instructor: knza ch
Introduction Artificial Intelligent.
Artificial Intelligence introduction(2)
Ada – 1983 History’s largest design effort
Emergence of Intelligent Machines: Challenges and Opportunities
Prof. Jason Eisner MWF 3-4pm (sometimes 3-4:15)
CS 3304 Comparative Languages
Introduction To software engineering
CS 3304 Comparative Languages
TA : Mubarakah Otbi, Duaa al Ofi , Huda al Hakami
Agile testing for web API with Postman
Principles of Programming Languages
CISC 7120X Programming Languages and Compilers
Discrete Mathematics in the Real World
Functional Programming and Haskell
Web Application Development Using PHP
AI Application Session 12
Functional Programming and Haskell
Presentation transcript:

Haskell Chapter 1, Part I

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

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

Perspective 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. kind of like our testInverses… get the machine to do lots of calculations

Theory of Computation What is effectively computable? 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

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. Keeping track of employees? Not FP. Playing a chess game? Maybe FP.

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/

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

Haskell 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

Real-world FP - F# 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.)

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