How To Write A Programmg With A State Monad And An Imperative Dsl
|
|
- Blaze Robbins
- 3 years ago
- Views:
Transcription
1 Outle Doma Specific Languages Lecture 2: The State Monad and an Imperative DSL Verónica Gaspes ceres School of Information Science, Computer and Electrical Engeerg February 2 Programmg with monads Computations The Monad class Usg monads and the do notation Controllg a Robot The language Implementation QuickCheck Results and more... A little language data Term = Con Int Div Term Term derivg Show eval :: Term -> Int eval (Con x) = x eval (Div t1 t2) = eval t1 div eval t2 Here is a term: answer = Div (Div (Con 1972)(Con 2))(Con 23) Here is how to evaluate it: eval answer And the result: 42 How do we modify eval to count the number of divisions or to output a trace? Addg output Outputg a trace type O a = (Output, a) type Output = Strg evaltrace :: Term -> O Int evaltrace (Con x) = (le (Con x) x, x) evaltrace (Div t1 t2) = let (s1,x1) = evaltrace t1 (s2,x2) = evaltrace t2 (s1++s2++le(div t1 t2)(x1 div x2), x1 div x2) Would it have been easier to extend a C program?
2 Addg state Countg the number of divisions type S a = State -> (a, State) type State = Int evalcount :: Term -> S Int evalcount (Con x) c = (x,c) evalcount (Div t1 t2) c = let (x1,c1) = evalcount t1 c (x2,c2) = evalcount t2 c1 (x1 div x2, c2+1) Would it have been easier to extend a C program? Sequencg It is a matter of programmg style! We want to capture the possibility of calculatg a result while dog somethg else way that makes it easy to sequence! The class Monad is an attempt at this The Monad class class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b a is the type of values we are terested. m is the type constructor that captures the extra thgs we want to do. The bd operator >>= >>= for eval with output (>>=) :: m a -> (a -> m b) -> m b do notation calc >>= f do val <- calc f val Will be defed differently for the different types m. Calculates accordg to calc. Results some compound that cludes the value val. f val can now be used to calculate! data O a = O Output a type Output = Strg return :: a -> O a (>>=) :: O a -> (a -> O b) -> O b return x = O "" x calc >>= f = let O s1 x1 = calc O s2 x2 = f x1 O (s1++s2) x2
3 Evaluatg and dog output Defition of evaltrace evaltrace :: Term -> O Int evaltrace (Con x) = do out (le (Con x) x) return x evaltrace (Div t1 t2) = do v1 <- evaltrace t1 v2 <- evaltrace t2 out (le (Div t1 t2) (v1 div v2)) return (v1 div v2) Evaluatg and countg Defition of evalcount evalcount :: Term -> S Int evalcount (Con x) = return x evalcount (Div t1 t2) = do v1 <- evalcount t1 v2 <- evalcount t2 c return (v1 div v2) Outputg without computg out :: Output -> O () out s = O s () Countg without computg c :: S () c = S (\x -> ((),x+1)) The state monad An imperative language The last one is an example of a very useful monad because it is related to imperative programmg: Values are computed while changg a global state. We will now see how to use a state monad to implement a little embedded DSL. The language is meant to control a robot livg a grid. data S a = S (State -> (a, State)) A robot program Executg it return :: a -> S a (>>=) :: S a -> (a -> S b) -> S b return x = S (\s->(x,s)) calc >>= st = S (\s -> let S f = calc (x1,s1) = f s S g = st x1 g s1) firstprogram = do move turnleft move move Ma> run firstprogram s0 g0 At (0,1) facg North with 0 cos At (-1,1) facg West with 0 cos At (-2,1) facg West with 0 cos Execution changes the state of the robot and produces some output!
4 A language to control a robot Atomic actions turnleft turnright turnto move pickco dropco Atomic state spection onco cos direction blocked Control ifthen ifthenelse while Boolean operations * &* neg >* <* The state of the robot The robot we plan to control lives a grid world In the grid the robot is characterized by its position, the direction it faces. Moreover, at some positions there are cos, and this is nown to the robot. The robot collects cos a pocket type Position = (Int, Int) data Direction = North East South West type Treasure = [Position] type Pocket = Int data RobotState = RobotState Position Direction Treasure Pocket ThetypeofRobotCommands Commands to the robot will change its state and will produce some output. Some of them will also compute terestg values! Robot commands data Robot a = Robot (RobotState -> Grid -> IO(RobotState,a)) stance Monad Robot where return a = Robot (\s _ -> return (s,a)) Robot sf0 >>= f = Robot $ \s0 g -> do (s1,a1) <- sf0 s0 g let Robot sf1 = f a1 (s2,a2) <- sf1 s1 g return (s2,a2) Implementg some RobotCommands atomic actions turnto :: Direction -> Robot() turnto d = updatestate stateturnto where stateturnto (RobotState x y z u) = RobotState x d z u Most commands will result changg the state or spectg the state, so we defe Auxiliary for implementation updatestate u = Robot (\s _ -> return (u s,())) querystate q = Robot (\s _ -> return (s, q s))
5 Implementg some RobotCommands Boolean blocked :: Robot Bool blocked = Robot (\s g -> return (s, stateblocked s g)) stateblocked (RobotState p d ) g=isblocked d (g!p) isblocked North (True, _, _, _) = False isblocked East (_, True, _, _) = False isblocked South (_, _, True, _) = False isblocked West (_, _, _, True) = False isblocked = True neg :: Robot Bool -> Robot Bool neg r = do b <- r return (not b) Implementg some RobotCommands Control ifthenelse :: Robot Bool -> Robot a -> Robot a -> Robot a ifthenelse p r1 r2 = do c <- p if c then r1 else r2 ifthen p r = ifthenelse p r (return ()) while :: Robot Bool -> Robot () -> Robot () while p r = ifthen p step where step = do r while p r QuickCheck, yet another monadic DSEL QuickCheck, yet another monadic DSEL A problem Software testg can be automated usg specification based testg combation with random data generation A solution A DSEL to write specifications, a DSEL to generate data, a program that automates testg! John Huges and Koen Claesen, 350 les of haskell code. Properties Bool Bool ==> Prop forall Gen $ \x-> Prop collect expr Prop The tool quickcheck property Data generators return expr do x1 <- Gen. xn <- Gen Gen arbitrary oneof [Gen] frequency [(Int,Gen)]
6 Summary We discussed Monads as a way of structurg programs tha express computations. We used a State Monad to implement a little imperative language. We briefly discussed a language for automatic specification based testg. Outlook We will look at how to embedd a compiler haskell.
The countdown problem
JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON
More informationTesting and Tracing Lazy Functional Programs using QuickCheck and Hat
Testing and Tracing Lazy Functional Programs using QuickCheck and Hat Koen Claessen 1, Colin Runciman 2, Olaf Chitil 2, John Hughes 1, and Malcolm Wallace 2 1 Chalmers University of Technology, Sweden
More informationFormal Methods for Software Development
Formal Methods for Software Development Till Mossakowski, Lutz Schröder 03./08.11.2004 2 Monadic QuickCheck extension of QuickCheck for monadic (= imperative) programs specifications are equations between
More informationAdvanced Functional Programming (9) Domain Specific Embedded Languages
Advanced Functional Programming (9) Domain Specific Embedded Languages Advanced Functional Programming (9) Domain Specific Embedded Languages, Universiteit Utrecht http://www.cs.uu.nl/groups/st/ February
More informationOutline Basic concepts of Python language
Data structures: lists, tuples, sets, dictionaries Basic data types Examples: int: 12, 0, -2 float: 1.02, -2.4e2, 1.5e-3 complex: 3+4j bool: True, False string: "Test string" Conversion between types int(-2.8)
More information9/23/2014. http://jatinga.iitg.ernet.in/~asahu/cs431/
Dr A Sahu Dept of Computer Science & Engeerg IIT Guwahati Admistrative thgs SML stallation and Book ML Motivation ML : Meta Language (Basic Concepts) Expression, Type Consistency, Variable & Environment
More informationmonadws: A Monad-Based Testing Tool for Web Services
monadws: A Monad-Based Testing Tool for Web Services College of Computer, Nanjing University of Posts and Telecommunications, Nanjing 210003, China Yingzhou Zhang, Wei Fu, Changhai Nie Email: zhangyz@njupt.edu.cn
More informationSpecimen 2015 am/pm Time allowed: 1hr 30mins
SPECIMEN MATERIAL GCSE COMPUTER SCIENCE 8520/1 Paper 1 Specimen 2015 am/pm Time allowed: 1hr 30mins Materials There are no additional materials required for this paper. Instructions Use black ink or black
More informationA GRAPH REWRITING VISUAL LANGUAGE FOR DATABASE PROGRAMMING
GRPH REWRITING VISUL LNGUGE FOR DTBSE PROGRMMING PJ Rodgers University Sheffield PJH Kg Birkbeck College, University London contact: Peter Rodgers, Department Computer Science, University Sheffield, Regent
More informationUnix System Programming with Standard ML
Unix System Programmg with Standard ML Unix System Programmg with Standard ML Copyright 2001 by Anthony L. Shipman Version: 0.1, Mar 2002 Permission is granted for you to make copies of this version of
More informationFormal Methods for Software Development
Formal Methods for Software Development Till Mossakowski, Lutz Schröder 20.10.2004 2 Overview of this Lecture MMISS Software Development and Formal Specification Overview of the course Scheinkriterien
More informationGrid Workflow for Decision Resource Scheduling
Grid Workflow for Decision Resource Schedulg Mgsheng Hu 1 2,Jianjun Zhang 3,Xueguang Chen 1 (Institute of Systems Engeerg, Huazhong University of Science and Technology, 430074, P.R.Cha)1 (Institute of
More informationStatic Analysis for Fast and Accurate Design Space Exploration of Caches
Static Analysis for Fast and Accurate Design Space Exploration of Caches Yun iang, Tulika Mitra Department of Computer Science National University of Sgapore {liangyun,tulika}@comp.nus.edu.sg ABSTRACT
More informationThe non-trivial Java example Mouse in a Maze
The non-trivial Java example Mouse in a Maze A simple software development process from specification, to design, implementation, and test DAAD project Joint Course on OOP using Java Humboldt University
More informationEnhancing Embedded Software System Reliability using Virtualization Technology
86 IJCSNS International Journal of Computer Science and Network Security, VOL.8 No., November 008 Enhancg Embedded Software System Reliability usg Virtualization Technology Thandar The, Sung-Do Chi and
More informationAll of our customers ask what are the best practices you recommend for Marketo?
All of our customers ask what are the best practices you recommend for Marketo? The answer is not that simple. Understandg AND respectg that each Marketo implementation stance is unique dictates best practices
More information15-150 Lecture 11: Tail Recursion; Continuations
15-150 Lecture 11: Tail Recursion; Continuations Lecture by Dan Licata February 21, 2011 In this lecture we will discuss space usage: analyzing the memory it takes your program to run tail calls and tail
More informationChapter 5. Selection 5-1
Chapter 5 Selection 5-1 Selection (Decision) The second control logic structure is selection: Selection Choosing between two or more alternative actions. Selection statements alter the sequential flow
More informationA Design of Low Power Single Axis Solar Tracking System Regardless of Motor Speed
Journal Integrated Engeerg, Vol. 3 No. 3 (2011) p. International Journal Integrated Engeerg, Vol. 3 No. 2 (2011) p. 5-9 5-9 A Design Low Power Sgle Ax Trackg System Regardless Mor Speed Asmarhid Ponniran
More information1-bit Full Adder. Adders. The expressions for the sum and carry lead to the following unified implementation:
1-bit Full Adder 1 The expressions for the sum and carry lead to the followg unified implementation: Sum A Carry C B This implementation requires only two levels of logic (ignorg the verters as customary).
More informationLecture 12: Abstract data types
Lecture 12: Abstract data types Algebras Abstract data types Encapsulation and information hiding Parameterization Algebras Definition Which kinds of data do we want to discuss? What can we do with it?
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
More informationChapter 7: Functional Programming Languages
Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language
More information2C11. Business economics and entrepreneurship
2C11 Busess economics and entrepreneurship Claudiu Albulescu (12/05/2014) European Erasmus Mundus Master Course Sustaable Constructions under Natural 520121-1-2011-1-CZ-ERA MUNDUS-EMMC Sustaable Constructions
More informationTips to increase your. Email Open Rate
7 Tips to crease your Email Open Rate 7 Tips to crease your Email Open Rate It is always important to measure what happens to your email message after shootg it. Email open rates enable you to measure
More informationHigh-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)
High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming
More informationIntegration of catalogs into a B2B broker
Integration of catalogs to a B2B broker Manfred Jeusfeld CentER AR at jeusfeld@kub.nl 1 Esprit project MEMO http://www.abnamro.com/memo/ Mediatg and monitorg Electronic commerce Provide a trustable platform
More informationA Publication of Miles Technologies { } How to Choose. Custom Software Vendor
A Publication of Miles Technologies { } How to Choose the Right Custom Software Vendor 2 WHY SOFTWARE IS SO CRUCIAL Powerg your busess with software that is tailored to your busess processes and your clients
More informationQuickLaunch. Program for. Marketo
QuickLaunch Program for Marketo QuickLaunch Program QuickLaunch Program for Marketo comes an with entire suite of itial set up you need to have to be successful with Marketo. It is designed to help your
More informationBest practices to optimize email content for any screen
Best practices to optimize email content for any screen Customer communication and relationship management have changed a huge way. Now companies and brands are more agile than ever before allowg them
More informationINF5140: Specification and Verification of Parallel Systems
INF5140: Specification and Verification of Parallel Systems Lecture 7 LTL into Automata and Introduction to Promela Gerardo Schneider Department of Informatics University of Oslo INF5140, Spring 2007 Gerardo
More information5 Strategies for Mastering Your Email Marketing
5 Strategies for Masterg Your Email Marketg Today, email marketg is one of the major catalysts of generatg more leads. When done correctly, ROI from the email marketg can yield the highest as compared
More informationProgramming and Reasoning with Algebraic Effects and Dependent Types
Programming and Reasoning with Algebraic Effects and Dependent Types Edwin C. Brady School of Computer Science, University of St Andrews, St Andrews, Scotland. Email: ecb10@st-andrews.ac.uk Abstract One
More informationConceptual Design of Data Warehouses from E/R Schemes
Conceptual Design of Data Warehouses from E/R Schemes Matteo Golfarelli Dario Maio Stefano Rizzi DEIS - Univ. of Bologna DEIS, CSITE - Univ. of Bologna DEIS - Univ. of Bologna mgolfarelli@deis.unibo.it
More informationJob Description. BI & Data Manager. Titles of Direct Reports: Data Analyst, Developer, BI Developer,
Job Description Job Title : BI & Data Manager Department : IT Reportg to (Job Title) : IT System Development Manager No of Direct Reports : 3-8 Titles of Direct Reports: Data Analyst, Developer, BI Developer,
More informationAfter: bmotorreflected[port2]= 1; //Flip port2 s direction
Motors Motor control and some fine-tuning commands. motor[output] = power; This turns the referenced VEX motor output either on or off and simultaneously sets its power level. The VEX has 8 motor outputs:
More informationChapter 15 Functional Programming Languages
Chapter 15 Functional Programming Languages Introduction - The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,
More informationMonads for functional programming
Monads for functional programming Philip Wadler, University of Glasgow Department of Computing Science, University of Glasgow, G12 8QQ, Scotland (wadler@dcs.glasgow.ac.uk) Abstract. The use of monads to
More informationProgramming Language Rankings. Lecture 15: Type Inference, polymorphism & Type Classes. Top Combined. Tiobe Index. CSC 131! Fall, 2014!
Programming Language Rankings Lecture 15: Type Inference, polymorphism & Type Classes CSC 131 Fall, 2014 Kim Bruce Top Combined Tiobe Index 1. JavaScript (+1) 2. Java (-1) 3. PHP 4. C# (+2) 5. Python (-1)
More informationPretty-big-step semantics
Pretty-big-step semantics Arthur Charguéraud INRIA October 2012 1 / 34 Motivation Formalization of JavaScript with Sergio Maeis, Daniele Filaretti, Alan Schmitt, Martin Bodin. Previous work: Semi-formal
More informationRigorous Software Development CSCI-GA 3033-009
Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 11 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical
More informationDecision Logic: if, if else, switch, Boolean conditions and variables
CS 1044 roject 3 Fall 2009 Decision Logic: if, if else, switch, Boolean conditions and variables This programming assignment uses many of the ideas presented in sections 3 through 5 of the Dale/Weems text
More informationFrom Interpreter to Compiler and Virtual Machine
BRICS From Interpreter to Compiler and Virtual Machine Mads Sig Ager BRICS, University of Aarhus, Denmark Joint work with Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard 1 Examples of machines Krivine
More informationThe Needle Programming Language
The Needle Programming Language The Needle Programming Language 1 What is Needle? Needle is an object-oriented functional programming language with a multimethod-based OO system, and a static type system
More informationFunctional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
More informationHaskell Programming With Tests, and Some Alloy
Haskell Programming With Tests, and Some Alloy Jan van Eijck jve@cwi.nl Master SE, 2010 Abstract How to write a program in Haskell, and how to use the Haskell testing tools... QuickCheck is a tool written
More informationProgramming and Reasoning with Side-Effects in IDRIS
Programming and Reasoning with Side-Effects in IDRIS Edwin Brady 19th October 2014 Contents 1 Introduction 3 1.1 Hello world............................................. 3 1.2 Outline................................................
More informationEnterprise mobility in 2014 Experts weigh in on evolving mobility and BYOD trends
Enterprise mobility 2014 Experts weigh on evolvg mobility and Enterprise mobility 2014: Experts weigh on evolvg mobility and BYOD contues as With end-user demands for anytime, anywhere access to applications
More informationProblems and Measures Regarding Waste 1 Management and 3R Era of public health improvement Situation subsequent to the Meiji Restoration
More information
Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)
Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the
More informationRigorous Software Engineering Hoare Logic and Design by Contracts
Rigorous Software Engineering Hoare Logic and Design by Contracts Simão Melo de Sousa RELEASE (UBI), LIACC (Porto) Computer Science Department University of Beira Interior, Portugal 2010-2011 S. Melo de
More informationLecture Notes on Linear Search
Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is
More informationA Programmer-Centric Approach to Program Verification in ATS
A Programmer-Centric Approach to Program Verification ATS Zhiqiang Ren 1 and Hongwei Xi 1 1 Boston University, Boston, Massachusetts, U.S.A. aren@cs.bu.edu 2 Boston University, Boston, Massachusetts, U.S.A.
More informationThomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation
Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm
More informationMidlands Graduate School in the Foundations of Computer Science
Midlands Graduate chool in the Foundations of omputer cience Operational emantics, Abstract Machines, and orrectness Roy L. role University of Leicester, 8th to 12th April 2006 University of Nottingham,
More informationQuick Start Guide. June 3, 2012
The ERIGONE Model Checker Quick Start Guide Mordechai (Moti) Ben-Ari Department of Science Teaching Weizmann Institute of Science Rehovot 76100 Israel http://stwww.weizmann.ac.il/g-cs/benari/ June 3, 2012
More informationPOLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful
POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/
More informationHigh Power Factor and High Efficiency You Can Have Both
High ower Factor and High Efficiency You Can Have Both Isaac Cohen and Bg Lu Abstract Topic Although improvg the power-supply power factor (F) can offer significant and necessary reductions distribution
More informationSunroof: A Monadic DSL to Generate JavaScript
Sunroof: A Monadic DSL to Generate JavaScript Jan Bracker 1,2 and Andy Gill 1 1 ITTC / EECS The University of Kansas, Lawrence, KS 66045 2 Institut für Informatik Christian-Albrechts-Universität, Kiel,
More informationAlgorithms and Data Structures Written Exam Proposed SOLUTION
Algorithms and Data Structures Written Exam Proposed SOLUTION 2005-01-07 from 09:00 to 13:00 Allowed tools: A standard calculator. Grading criteria: You can get at most 30 points. For an E, 15 points are
More informationJ a v a Quiz (Unit 3, Test 0 Practice)
Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points
More informationFunctional Programming in C++11
Functional Programming in C++11 science + computing ag IT-Dienstleistungen und Software für anspruchsvolle Rechnernetze Tübingen München Berlin Düsseldorf An Overview Programming in a functional style
More informationMeasuring National Output and National Income. Gross Domestic Product (GDP) Calculating GDP. Gross National Product (GNP) Expenditure Approach
Measurg National Output and National Income Chapter 7 Gross Domestic Product (GDP) GDP is the market value of all fal goods and services produced with a given period by factors of production located with
More informationWESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math
Textbook Correlation WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Following Directions Unit FIRST QUARTER AND SECOND QUARTER Logic Unit
More information1 Operational Semantics for While
Models of Computation, 2010 1 1 Operational Semantics for While The language While of simple while programs has a grammar consisting of three syntactic categories: numeric expressions, which represent
More informationProgramming Languages in Artificial Intelligence
Programming Languages in Artificial Intelligence Günter Neumann, German Research Center for Artificial Intelligence (LT Lab, DFKI) I. AI programming languages II. Functional programming III. Functional
More informationSYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis
SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis M. Vidyasagar Cecil & Ida Green Chair The University of Texas at Dallas Email: M.Vidyasagar@utdallas.edu October 17, 2015 Outline
More informationGENERAL INSURANCE CONVENTION BOURNEMOUTH, OCTOBER 1995 DESIGNING AD-HOC MANAGEMENT REPORTING SYSTEMS
1995 General Insurance Convention GENERAL INSURANCE CONVENTION BOURNEMOUTH, OCTOBER 1995 DESIGNING AD-HOC MANAGEMENT REPORTING SYSTEMS Workg Party memrs: Brian Gedalla Simon Kneller Edward Levay David
More informationShell Scripts (1) For example: #!/bin/sh If they do not, the user's current shell will be used. Any Unix command can go in a shell script
Shell Programming Shell Scripts (1) Basically, a shell script is a text file with Unix commands in it. Shell scripts usually begin with a #! and a shell name For example: #!/bin/sh If they do not, the
More informationQWeS 2 T for Type-Safe Web Programming
QWeS 2 T for Type-Safe Web Programmg Thierry Sans Iliano Cervesato Carnegie Mellon University, Qatar Abstract Web applications (webapps) are very popular because they are easy to prototype and they can
More informationAdding GADTs to OCaml the direct approach
Adding GADTs to OCaml the direct approach Jacques Garrigue & Jacques Le Normand Nagoya University / LexiFi (Paris) https://sites.google.com/site/ocamlgadt/ Garrigue & Le Normand Adding GADTs to OCaml 1
More informationThe first program: Little Crab
CHAPTER 2 The first program: Little Crab topics: concepts: writing code: movement, turning, reacting to the screen edges source code, method call, parameter, sequence, if-statement In the previous chapter,
More informationSummit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A
Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A Developed By Brian Weinfeld Course Description: AP Computer
More informationPython Evaluation Rules
Python Evaluation Rules UW CSE 160 http://tinyurl.com/dataprogramming Michael Ernst and Isaac Reynolds mernst@cs.washington.edu August 2, 2016 Contents 1 Introduction 2 1.1 The Structure of a Python Program................................
More informationProgramming with Arrows
Programming with Arrows John Hughes Department of Computer Science and Engineering, Chalmers University of Technology, S-41296 Sweden. 1 Introduction 1.1 Point-free programming Consider this simple Haskell
More informationGluing things together with Haskell. Neil Mitchell http://nmitchell.co.uk/
Gluing things together with Haskell Neil Mitchell http://nmitchell.co.uk/ Code Elegantly designed Build system Test harness Continuous integration Release bundling Installer generator Release distribution
More informationJava Program Coding Standards 4002-217-9 Programming for Information Technology
Java Program Coding Standards 4002-217-9 Programming for Information Technology Coding Standards: You are expected to follow the standards listed in this document when producing code for this class. Whether
More informationReasoning Component Architecture
Architecture of a Spam Filter Application By Avi Pfeffer A spam filter consists of two components. In this article, based on my book Practical Probabilistic Programming, first describe the architecture
More informationCHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks
CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks Figure 18-1. Computers, even small ones like the phone in your pocket, are good at performing millions of operations in a single second.
More informationSoftware Engineering using Formal Methods
Software Engineering using Formal Methods Model Checking with Temporal Logic Wolfgang Ahrendt 24th September 2013 SEFM: Model Checking with Temporal Logic /GU 130924 1 / 33 Model Checking with Spin model
More informationSoftware safety - DEF-STAN 00-55
Software safety - DEF-STAN 00-55 Where safety is dependent on the safety related software (SRS) fully meeting its requirements, demonstrating safety is equivalent to demonstrating correctness with respect
More informationCSCE 110 Programming I Basics of Python: Variables, Expressions, and Input/Output
CSCE 110 Programming Basics of Python: Variables, Expressions, and nput/output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Fall 2011 Python Python was developed
More information2 The first program: Little Crab
2 The first program: Little Crab topics: concepts: writing code: movement, turning, reacting to the screen edges source code, method call, parameter, sequence, if statement In the previous chapter, we
More informationWe will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
More informationCompila(on for the composi(on of so2ware protec(ons for embedded systems
Compila(on for the composi(on of so2ware protec(ons for embedded systems Thierno BARRY 1 Damien COUROUSSÉ 1 Bruno ROBISSON 2 1 CEA LIST / DACLE 2 CEA / DPACA Firstname.LASTNAME@cea.fr Porquerolles Tuesday,
More information1. Definitions. Bill No. 330 2014. By-law C.P.-1496-244. A by-law respecting development charges.
Bill No. 33 214 Bylaw C.P.1496244 A bylaw respectg development charges. WHEREAS the Development Charges Act, 7997 S.C. 1997, c.27, as amended authorizes bylaws of the council of a municipality for the
More informationHow to Increase Form Conversion Rate
How to Increase Form Conversion Rate How to crease form conversion rate The Internet is a fascatg place, although the speed at which thgs happen brgsa unique challenge. It is believed that customers are
More informationCONTENTS. What is ROBOTC? Section I: The Basics
BEGINNERS CONTENTS What is ROBOTC? Section I: The Basics Getting started Configuring Motors Write Drive Code Download a Program to the Cortex Write an Autonomous Section II: Using Sensors Sensor Setup
More informationLecture 23: Common Emitter Amplifier Frequency Response. Miller s Theorem.
Whites, EE 320 ecture 23 Page 1 of 17 ecture 23: Common Emitter mplifier Frequency Response. Miller s Theorem. We ll use the high frequency model for the BJT we developed the previous lecture and compute
More informationHomeowner Emergency Loan Program (HELP)
Homeowner Emergency Loan Program (HELP) Program Overview HELP is available to assist low-come homeowners the City of Lewiston who need immediate assistance to address health and life safety issues. Program
More informationThe Clean programming language. Group 25, Jingui Li, Daren Tuzi
The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was
More informationDoina Bucur. Temporal Monitors for
Doina Bucur / Temporal Monitors for 1 Application area: wireless sensor/actuator systems running TinyOS, a best-effort, asynchronous embedded OS In summary: 2 Application area: wireless sensor/actuator
More information[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
More informationLearning mathematics Some hints from the psychologists Examples:
Learning mathematics Some hints from the psychologists In your degree course you will learn, and be examined on: 1. Facts (= knowing that ) 2. Skills (= knowing how ). Examples: An example of a fact to
More informationFunctional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
More informationFun with Phantom Types
1 Fun with Phantom Types RALF HINZE Institut für Informatik III, Universität Bonn Römerstraße 164, 53117 Bonn, Germany Email: ralf@informatik.uni-bonn.de Homepage: http://www.informatik.uni-bonn.de/~ralf
More informationSoftware Engineering Techniques
Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary
More informationMODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence : 0660-3
MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence : 0660-3 CMPS03 Magnetic Compass. Voltage : 5v only required Current : 20mA Typ. Resolution : 0.1 Degree Accuracy : 3-4 degrees approx. after calibration Output
More information