Week 2: Git and First Functions
|
|
- Reynard Osborne
- 6 years ago
- Views:
Transcription
1 Week 2: Git and First Functions Steven X. Han In this lab you will complete Lab 1 by submitting your work into git so that your tutor can access it. To do so successfully, read all explanations below very carefully. Afterwards you will learn some essential Haskell data types and constructs (guard expressions and case expressions) and write your own Haskell programs to practice them. Once you are done, remember to push the final version of your code via git before your next lab, so that your tutor can mark it. Remember to make an independent commit of your work for every exercise! It is normal that you don t finish the content during the lab, because you are expected to finish the rest of them as homework. Pre-lab checklist You need to know how to write simple functions in Haskell. You have to have finished Lab 1. Objectives In this lab you will... learn how to use git attempt writing functions with guard and case 1
2 Git So.. what is git? Git is a type of version control system (VCS), and as you can probably deduce from VCS, it keeps track of your progress as you work on a file. Think of it as an advanced Dropbox! If you are familiar with Time Machine backup on Mac computers, Time Machine is a type of version control system as well. If you want to read more about VCS and Git, Wikipedia has a very comprehensive article on it: Why don t we just use Dropbox then? Git provides very advanced version control, as such, it is very easy to revert back to any commit point in the past (provided that you have committed properly - we will go through this soon). It also provides an excellent interface from command line/terminal so that operations can be batch processed and you have full control over what s committed, what s pushed, and what s deleted. Usage In this section we will go through how to use git. Basic Concepts Repositories This is where your root folder in the cloud is called. For example, you can create a repository called comp1100-assignment-1, in which all the files related to your assignment 1 are. Similarly for subsequent assignments, you can create repositories for them as well. Adding files When you create a file (let s say.. mywork.hs) in a folder on your computer, it isn t necessarily in your git repository yet, because you haven t told git to manage that file. In order to tell git Hey, I want you to manage this file!, you just type in git add mywork.hs and git will now start managing this file. If you want to add everything in the directory, simply type git add. (notice the dot!), and this tells git to watch for everything in this folder. Commit your changes When you change something, and you want to save your current progress, you will need to let git know. It s almost like a save game function, but instead of going to a save point, you type in git commit -m "Some commit message." 2
3 The -m stands for with commit message, and the message inside the double quotation marks are your commit message (keep the double quotes!). Write something meaningful, such as Implemented areaoftriangle, testing needed.. instead of Commit 1.. The commit message should remind you of your progress, so instead of using your brain to store this information, you can store it on the computer. People with whom you have shared your files will also be able to see these messages and figure out where you are at. Important: Only commit code that compiles. Never commit code that does not. Push After you have added your files, committed your changes (which you can do without an internet connection by the way, because everything is processed locally), you will need to upload (push) all the progress you have made on your computer to the server, so your tutor, and you, when you have moved to another computer, will be able to see the files you have been working on, along with all the commits and commit messages. To do this, simply just type in git push Pull After you have pushed on your computer, and you go to a lab (or vice versa), you can download (pull) the stuff from the cloud down to your local computer, by typing git pull origin master Think of it as the exact opposite of pushing. The origin bit means you want to pull the stuff from origin repository, and master bit means you want to get the master branch (don t worry if you don t understand this right now, it will become clear to you as you use it more often). Merge If you have done everything properly, i.e., push every time you finish working on a computer, and pull every time before you start working on a computer, you should never need to merge anything since there shouldn t be any conflicts. In the unfortunate event that you do have to merge, I would recommend you to go to the following web page to get more information on merging since it s a bit too complicated to cover here: Fork Forking a repository creates an identical copy to the original repository, but if you change things on the fork, the original repository isn t affected. In this course you will need to fork the lab materials in order to obtain them, and the assignment documents, in order to do your assignments. Forking is done through the graphical user interface on GitLab. 3
4 ANU Environment For this course, we are using GitLab as our cloud. It is a nice interface to the git server, and does not much more than that. The eagle eyed ones amongst you would have noticed, we ve been talking about committing, pushing, and pulling, but where to/from? Git can t figure out magically which repository to push to, or pull from. It also doesn t know what you are committing to. In order to make this all work, we will need to do some foundation work. git init This command will initialise the current directory and set up necessary preliminary stuff for it to function as a git managed folder. git remote -v The repository in the cloud is called a remote, and this command lists all the remotes which are associated with the git repository in the current folder. (If it s blank, it means this current folder isn t linked up to any remote repositories) git remote add remotename remoteurl As you can probably guess, this adds a remote to the git repository in the current folder. We call the remote which we are about to add, remotename, although for the main remote, you should call that origin. For remoteurl, there are two formats, for accessing the remote via different protocols. For simplicity, we will be using the HTTPS protocol for now, but if you understand how to use ssh protocol, you might find that beneficial in some circumstances. So to add your main repository, you should type in something along the lines of git remote add origin you should of course replace uxxxxxxx with your GitLab username, which should be your uni ID. git remote add upstream upstreamurl After you have forked a directory, what happens when the original repository gets updated? Sometimes this isn t an issue, but most often, you will want that change to be in your fork. For instance, later in this lab you will pull the week 2 lab materials. In week 3, the lecturer will update the material in the original repository, and for obvious reasons you want to get the week 3 materials in your fork. What do you do? You add an upstream, from which the changes can flow down. In this case, the upstream of your repository is the course lab repository. Whenever something gets updated in the upstream, you can type in git pull upstream master in order to receive the updates. 4
5 Your turn! Okay that was a lot of reading! It s time for some magic Terminal actions. Open up IntelliJ, and in the Terminal window, it s your task to do the following, do feel free to refer to the sections above if you forgot which functions to use: 1. Make sure you are in ~/IdeaProjects/COMP1100 as we created in Lab Initialise the directory as a git repository 3. Open up the course s shared directory comp1100/labs.git, and click on Fork 4. Select your user, this will start the forking progress. Select User Afterwards, there will be a banner on the top, saying The project was successfully forked. Fork 5. Just below the repository name, there s a dropdown, defaulted to SSH. Select it, and change it to HTTPS. Copy the updated URL on the right of this button. This is the URL of your COMP1100 repository. 6. Back in your IntelliJ Terminal, add a remote, called origin, with the URL you just copied above. 7. Add the course s shared directory as the upstream repository. 8. Pull the files from the cloud down to your computer using git. Make sure that folder Lab02 appears locally on your machine after you pull. 9. Create folder Lab01 in your local git repository and add your Area.hs file which you made last week there. Commit this change with an appropriate message. Push the changes back to the cloud. Read and understand the terminal message that appears after you push. Act accordingly, if required. 10. Go back to your GitLab repo (in the cloud) to see if Lab01/Area.hs is now there. 11. Share your GitLab repository with your tutor as follows: 1. Click on Settings on the top right of the page Settings 2. Select Members from the sub-menu Members 3. In the Search for members to update or invite, type in your tutor s name, and click on the result. 5
6 4. Set the permission to REPORTER Reporter Access 5. Click Add to project Before proceeding, make sure that you successfully pushed the code you have implemented in Lab1 into the GitLab repo. Go to (substitute XXXXXXX with your ID) via your browser and observe the changes in the repository. Make sure that you shared your GitLab repo with your tutor. Make sure that you understand all git commands described above and what they do. You will use these commands for submitting your solutions to all labs and assignments. 6
7 Conditional functions The functions you ve been working with so far are just simple mathematical calculations involving their inputs. But you can also write conditional functions in Haskell. Such functions contain syntax that allows to select among answers depending on the truth of certain conditions. There are several options for these syntactic structures in Haskell two important ones are case expressions and guarded expressions, also known as guards. We will start with guards, and we will learn case expressions later in the lab. Booleans Boolean is a data type that can be one of two values - True or False. Guards rely extensively on Booleans. A Boolean result is produced when the program evaluates a statement given by you. They can also be chained together, and produce more interesting Booleans. Try the following in GHCi (one line at a time): == 2 2 * 2 == == 2 2 * 2 == == 2 && 2 * 2 == == 2 && False True && True True && False False False True (False && True) 7
8 Exercise 1 - Guards Let s start by writing a function which replicates the following idea: I m running a supermarket, and planning on doing a promotion on premium ramen products. I have decided (against my consultants unanimous disagreement) to charge people less per packet the more packets they buy. The price guide can be found below. No of packets 1-5 $ $ $ $ $ $1.3 Price per packet Your job is to design a function, called totalprice, which takes the number of packets as the argument and outputs the total amount that should be charged. If you have previous programming experience with imperative languages (python, c, java, etc.), you will automatically think about if statements. However, despite its existence in Haskell, one should rarely use if as there are more elegant solutions out there which require less effort. Your if statements may be structured as the pseudo-code (code which conveys meaning only but doesn t strictly comply with any programming language syntaxes) below: totalprice (Integer x): if 1 <= x <= 5 then return (2 * x) else if 6 <= x <= 10 then return (1.8 * x) Guards can be thought of as a structure of if/then/else. Observe their syntax in the following example: grades :: Integer -> String grades x x >= 80 && x <= 100 = "High Distinction" x >= 70 && x < 80 = "Distinction" x >= 60 && x < 70 = "Credit" x >= 50 && x < 60 = "Pass" x >= 0 && x < 50 = "Fail" otherwise = error "Something's wrong." 8
9 someboolean = someresult is the basic syntax of guards. If unsure about Booleans, go back to the Boolean section and review. You can find function grades in Grades.hs that you pulled from the cloud repo. Load this function into GHCi (for this type ghci -W Grades.hs), and play with it. Try various values of the integer argument. With the assistance of the example code above, can you work out how to implement function totalprice you are asked to do? Implement this function in a separate file called Price.hs. Submission required: Exercise 1 9
10 Exercise 2 - Elegant Guards Haskell has this wonderful (you will love it once you truly understand it) concept of lazy evaluation. Let us explain this to you with an example (Lazy.hs): toolazy :: Integer -> String toolazy x x < 10 = "Input is less than 10" x < 5 = "Input is less than 5" Load Lazy.hs to GHCi. What happens when the input you ve given it is 8? What happens when the input is 3? Is this what you have expected? If so, great! If not, this is lazy evaluation in action! Haskell will find the first guard that satisfies the condition, and will ignore everything below. We can leverage on this and make our codes a bit simpler and more elegant. 1. Create the improvedgrades1 function in Grades.hs without using &&. In other words, write improvedgrades1 function with only one conjunct in the logical condition within each guard! 2. Write more elegant improvedtotalprice function in Price.hs to satisfy the requirements above. Submission required: Exercise 2 10
11 Exercise 3 - Guards are exhausted... or are they? For your totalprice and improvedtotalprice functions, what if a customer comes in and buys... no ramen noodles? Or some desperate student comes in, trying to be difficult, and buys 1001 packets? Do your functions handle these? Handling the 0 case is easy - if you don t buy any ramen noodles, you don t get charged! For the 1001 case, I... have to confess, I tricked you in the instructions. The instructions given to you simply did t specify what happened if they bought more than 1000 packets. Therefore it s not your fault! However, you should handle this situation somehow. You can see in the grades function, there is an otherwise clause. otherwise is synonymous to True when they are used in guards. So think back on the lazy evaluation property that we talked about, it will get executed if none of the Boolean expressions above it evaluate to True. You can implement an otherwise clause to your improvedtotalprice function, and throw an error when they try to buy more than 1000 packets. To throw an error, refer to the grades example. Now edit your improvedtotalprice function to handle the situations where a customer buys none, or buys more than 1000 packets. What happens if your improvedtotalprice function is called with a negative argument? Submission required: Exercise 3 11
12 Exercise 4 - Case You are not required to understand the code that s given to you in this exercise. Open up the file named Week.hs. In it, you will find our custom data type Day, which can be one of seven things, each representing a day of the week. The function showtheweek will call getname function (which you will implement) with every day of the week one by one, and prints them in the Terminal nicely. Your job is to write a function getname, which takes in our custom data type Day as an argument and outputs the String of that day s full name, e.g., getname Mon should return Monday. Take 5 minutes and try to implement this yourself. A pause in this document will be added for dramatic effect. << Pause >> You may have failed miserably by yourself. Don t worry, we are here to help! If you tried to use Guards to implement this, you might come across this error message: error: No instance for (Eq Day) arising from a use of == In the expression: day == Mon In a stmt of a pattern guard for an equation for getname : day == Mon In an equation for getname : getname day day == Mon = "Monday" This is because as Day is a custom data type, it is not automatically Equitable. It s like saying Chair A is equal to Chair B. How do you compare the chair? Do you compare the shape? The colour? The smell? The butt print?? However, when we are looking at a chair, we know, that it s a chair. How? Patterns! Chairs normally have a back, a place to sit, four legs, and sometimes arms. As long as we are certain of the rough definition of a chair, then we can generally conclude that it s a chair when we are looking at a chair-like object. Haskell can do similar things, but in a much better way. We can use case statements to do Pattern matching. For example, the getname function can be started with: getname :: Day -> String getname day = case day of Mon -> "Monday" The structure of case statements are: 12
13 case something of Pattern1 -> dothing1 Pattern2 -> dothing2 Pattern3 -> dothing3 Note that something can be an argument that was passed into the function (in our example, the day argument), or it can be a function call which returns something that you want to pattern match against (we will go into this in more detail later in this course). Can you now finish the getname function now? Submission required: Exercise 4 Just in case... The eagled eyes amongst you might have questioned - if guards can be nonexhaustive, can cases be too? The answer is - of course! What if the something matches against none of the patterns provided? Instead of otherwise in guards, we will use an underscore _ to represent Any pattern. Lazy evaluation rule also applies here. Question: Do you need to add a _ case for getname? Why or why not? 13
14 Exercise 5 - Maybe... Remember your last implementation of improvedgrades1. Since there is no grade for integer values below 0 and above 100, we displayed an error message in GHCi for these cases. This approach would not be ok if you programmed a flight controller just imagine the controller stopping flying the plane to display a message on the screen with an explanation why it cannot continue flying! There are several other methods to handle exceptional values or situations. One of them is to use special types that can hold some exceptional values on top of their normal value range. The simplest of these is the Maybe type, which can hold one special value Nothing (Note: Nothing is a value and not a type). This allows us to define a function that returns (or accepts) values of a specific type, but also has the option to say that it cannot return anything by returning value Nothing instead. So, the Maybe type is pre-defined in Haskell and it looks like this: data Maybe a = Nothing Just a where a stands for any type. First of all, let s define a new custom data type just like we did for Day: data Grade = HighDistinction Distinction Credit Pass Fail Your job is to write new function called improvedgrades2 function such that instead of a String, it returns a Grade, the data type we just defined. Your next task is to use the Maybe type to stop this function throwing an error when the marks put in are out of bound. Write function improvedgrades2 with the type signature improvedgrades2 :: Integer -> Maybe Grades Note that when the mark is within bounds, instead of a member X of the datatype Grades, we now return Just X. When the mark is out of bounds, we now return Nothing. Test your implementation of improvedgrades2 and see what GHCi displays as return values. Other numerical types use a similar concept. For instance, try to divide 1 by 0 in GHCi and see whether the output is what you expect: Prelude> 1 / 0 Submission required: Exercise 5 14
15 Exercise 6 - Maybe may be useful... maybe. Here s another problem. At some point, you will want to figure out what GPA corresponds to which Grade. To simplify things, here s a table modified from Grade Description Grade Point Value HD High Distinction 7 D Distinction 6 CR Credit 5 P Pass 4 N Fail 0 It would be handy if you could enter your mark, and it automatically calculated the GPA associated with that mark. e.g. if marktogpa 80 returned 7 as the result. Let s break this down to two steps. We have already written the part where you convert your mark to a grade. The next step is to write another function to convert grades to GPA. Therefore the new function should have the type signature of Maybe Grade -> Integer. You have already learnt that Maybe type is defined as follows: data Maybe a = Just a Nothing. How do you actually utilise this in a productive way? Let s start with an example: maybetoint :: Maybe Integer -> Integer maybetoint m = case m of Just i -> i Nothing -> 0 The example above takes in a Maybe Integer which is either Just Integer or Nothing. If it follows the pattern of Just <some integer value i>, return i, if it s Nothing, return 0. Have a closer look at the third line of this example - what is i? What s the data type of i? Your next task is to write a function maybegradetogpa :: Maybe Grade -> Integer in Grades.hs. (You will have to nest case statements!) Note, if the Maybe Grade is Nothing, return 0. Submission required: Exercise 6 15
16 Exercise 7 - Finally!... almost. Let s link all of these stuff up together! Let s list out the functions you ve already written and are going to use: * improvedgrade2 :: Integer -> Maybe Grade - This takes a raw mark and outputs a grade (HD, D, CR, P, N) * maybegradetogpa :: Maybe Grade -> Integer - This takes a Maybe Grade and outputs a GPA associated with that grade. What s the next step? Your final task is write a function: marktogpa :: Integer -> Integer, which takes in a raw mark in Integer (0 to 100) and outputs a GPA (0 to 7) associated with that mark. Submission required: Exercise 7 16
17 Exercise 8 - One last thing... Doctest. Just because your code compiles, doesn t mean it s doing what it s supposed to do. Consider the following: addone :: Integer -> Integer addone x = x + 50 Does this compile? Of course it does! Does this do what it s supposed to? Deducing from the name, it should take a number, and add one to it. However, what it actually does is taking a number, and add 50 to it. For simple functions like these, it s relatively easy to figure out that it s wrong before even compiling it. For more complicated functions, however, it is actually easier to compile it and simply run the code with a pre-determined input and expected output, and see if it does what you wanted it to. For example, if I compiled the above code and typed into GHCi: addone 5, I would expect 6 to be the answer, but it would give me 55. There is a very powerful tool in Haskell, which takes away the manual labour of testing everything yourself. You simply tell it what to do, what to expect, and it will check the functions for you. This is Doctest, which we will extensively use throughout the semester. What does a Doctest statement look like? main :: IO() main = undefined -- Adding one >>> addone >>> addone addone :: Integer -> Integer addone x = x + 50 If you copied and pasted the above code into a file called Adding.hs in IntelliJ, then in the Terminal (Notice, not in GHCi! If you are in GHCi, type :q to exit into Linux environment), type in doctest Adding.hs, it will give you the following output: > doctest Adding.hs ### Failure in Adding.hs:9: expression `addone 5' expected: 6 but got: 55 Examples: 2 Tried: 1 Errors: 0 Failures: 1 17
18 Notice that there was a main function, this is simply to make Doctest happy, not functionally anything. If you didn t have the main function, Doctest will complain and refuse to run! Your job is to edit your Week.hs, and Price.hs, such that they both utilise Doctest to ensure the functional correctness of your functions. Submission required: Exercise 8 18
19 Written by Steven X. Han. Some parts are modified from materials produced by Tony Hosking and Uwe Zimmer. 19
Intro. Scheme Basics. scm> 5 5. scm>
Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if
More informationUsing GitHub to Share with SparkFun a
Using GitHub to Share with SparkFun a learn.sparkfun.com tutorial Available online at: http://sfe.io/t52 Contents Introduction Gitting Started Forking a Repository Committing, Pushing and Pulling Syncing
More informationSubversion was not there a minute ago. Then I went through a couple of menus and eventually it showed up. Why is it there sometimes and sometimes not?
Subversion was not there a minute ago. Then I went through a couple of menus and eventually it showed up. Why is it there sometimes and sometimes not? Trying to commit a first file. There is nothing on
More informationGit. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes
Git Charles J. Geyer School of Statistics University of Minnesota Stat 8054 Lecture Notes 1 Before Anything Else Tell git who you are. git config --global user.name "Charles J. Geyer" git config --global
More informationIf Statements, For Loops, Functions
Fundamentals of Programming If Statements, For Loops, Functions Table of Contents Hello World Types of Variables Integers and Floats String Boolean Relational Operators Lists Conditionals If and Else Statements
More informationCS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist
CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist In Handout 28, the Guide to Inductive Proofs, we outlined a number of specifc issues and concepts to be mindful about when
More information9 R1 Get another piece of paper. We re going to have fun keeping track of (inaudible). Um How much time do you have? Are you getting tired?
Page: 1 of 14 1 R1 And this is tell me what this is? 2 Stephanie x times y plus x times y or hm? 3 R1 What are you thinking? 4 Stephanie I don t know. 5 R1 Tell me what you re thinking. 6 Stephanie Well.
More informationLab Exercise Git: A distributed version control system
Lunds tekniska högskola Datavetenskap, Nov 21, 2016 EDAF45 Programvaruutveckling i grupp projekt Labb 2 (Git): Labbhandledning Checked on Git versions: 2.7.4 Lab Exercise Git: A distributed version control
More informationWhat is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)
1 For the remainder of the class today, I want to introduce you to a topic we will spend one or two more classes discussing and that is source code control or version control. What is version control?
More informationRECURSION. Week 6 Laboratory for Introduction to Programming and Algorithms Uwe R. Zimmer based on material by James Barker. Pre-Laboratory Checklist
RECURSION Week 6 Laboratory for Introduction to Programming and Algorithms Uwe R. Zimmer based on material by James Barker Pre-Laboratory Checklist vvskills: You can write any conditional expression. vvknowledge:
More informationCIS 194: Homework 6. Due Friday, October 17, Preface. Setup. Generics. No template file is provided for this homework.
CIS 194: Homework 6 Due Friday, October 17, 2014 No template file is provided for this homework. Download the markets.json file from the website, and make your HW06.hs Haskell file with your name, any
More informationWhat is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;
What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development; Why should I use a VCS? Repositories Types of repositories: Private - only you and the
More informationLab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU
Lab 01 How to Survive & Introduction to Git Web Programming DataLab, CS, NTHU Notice These slides will focus on how to submit you code by using Git command line You can also use other Git GUI tool or built-in
More informationGit, the magical version control
Git, the magical version control Git is an open-source version control system (meaning, it s free!) that allows developers to track changes made on their code files throughout the lifetime of a project.
More informationVersion Control for Fun and Profit
Version Control for Fun and Profit Chris Brady Heather Ratcliffe The Angry Penguin, used under creative commons licence from Swantje Hess and Jannis Pohlmann. Warwick RSE 30/11/2017 Version control 30/11/2017
More informationGit Setup Help using GitKraken (CSE 154)
Git Setup Help using GitKraken (CSE 154) Introduction: Git enables keeping track of different versions of files as we keep editing them. To make sure we understand git properly, here are some terms you
More informationI m an egotistical bastard, and I name all my projects after myself. First Linux, now git. Linus Torvalds, creator of Linux and Git
I m an egotistical bastard, and I name all my projects after myself. First Linux, now git. Linus Torvalds, creator of Linux and Git Git Benedict R. Gaster University of West of England November 23, 2015
More informationSubmitting your Work using GIT
Submitting your Work using GIT You will be using the git distributed source control system in order to manage and submit your assignments. Why? allows you to take snapshots of your project at safe points
More informationCS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion
CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion Assorted Scheme Basics 1. The ( is the most important character in Scheme. If you have coded in other languages such as C or Java,
More informationWeek - 01 Lecture - 04 Downloading and installing Python
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and
More informationLecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han
Lecture 3: Processing Language Data, Git/GitHub LING 1340/2340: Data Science for Linguists Na-Rae Han Objectives What do linguistic data look like? Homework 1: What did you process? How does collaborating
More informationText Input and Conditionals
Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()
More informationRevision control. INF5750/ Lecture 2 (Part I)
Revision control INF5750/9750 - Lecture 2 (Part I) Problem area Software projects with multiple developers need to coordinate and synchronize the source code Approaches to version control Work on same
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More information(Refer Slide Time 6:48)
Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about
More informationCSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch
CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed
More informationWeb Hosting. Important features to consider
Web Hosting Important features to consider Amount of Storage When choosing your web hosting, one of your primary concerns will obviously be How much data can I store? For most small and medium web sites,
More informationLab 5: Web Application Test Automation
Software Testing MTAT.03.159 Lab 5: Web Application Test Automation Inst. of Comp. Science, University of Tartu Spring 2018 Instructions Submission deadline: Lab reports must be submitted within seven
More informationCSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209
CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System
More informationVersion Control. CSC207 Fall 2014
Version Control CSC207 Fall 2014 Problem 1: Working Solo How do you keep track of changes to your program? Option 1: Don t bother Hope you get it right the first time Hope you can remember what changes
More information4. Java Project Design, Input Methods
4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java
More informationTDDC88 Lab 4 Software Configuration Management
TDDC88 Lab 4 Software Configuration Management Introduction "Version control is to programmers what the safety net is to a trapeze artist. Knowing the net is there to catch them if they fall, aerialists
More informationCIS 194: Homework 5. Due Monday, 18 February. Expressions. (2 + 3) 4 would be represented by the value
CIS 194: Homework 5 Due Monday, 18 February Files you should submit: Calc.hs, containing a module of the same name. As we saw in class, Haskell s type classes provide ad-hoc polymorphism, that is, the
More informationLab Exercise Test First using JUnit
Lunds tekniska högskola Datavetenskap, Nov, 2017 Görel Hedin/Ulf Asklund EDAF45 Programvaruutveckling i grupp projekt Lab Exercise Test First using JUnit Goal This lab is intended to demonstrate basic
More informationGit. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)
Git A fast distributed revision control system Nils Moschüring PhD Student (LMU) Nils Moschüring PhD Student (LMU), Git 1 1 The three W s What? Why? Workflow and nomenclature 2 Overview of gits structure
More informationIT 220 Course Notes. Don Colton Brigham Young University Hawaii
IT 220 Course Notes Don Colton Brigham Young University Hawaii January 7, 2010 Contents 0 Preface 3 0.1 Why This Class?......................... 3 0.2 Expectations........................... 4 0.3 Basic
More informationCMSC 201 Fall 2016 Lab 09 Advanced Debugging
CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working
More informationCS 1110, LAB 10: ASSERTIONS AND WHILE-LOOPS 1. Preliminaries
CS 0, LAB 0: ASSERTIONS AND WHILE-LOOPS http://www.cs.cornell.edu/courses/cs0/20sp/labs/lab0.pdf. Preliminaries This lab gives you practice with writing loops using invariant-based reasoning. Invariants
More informationHOW TO WRITE RECURSIVE FUNCTIONS ON YOUR OWN
HOW TO WRITE RECURSIVE FUNCTIONS ON YOUR OWN In this tutorial, you ll learn - well, you ve already read the title - how to write recursive functions on your own. If you re the person to whom recursive
More informationLab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018
Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Due: Tuesday, September 18, 11:59 pm Collaboration Policy: Level 1 (review full policy for details) Group Policy: Individual This lab will give you experience
More informationCSE 332: Data Structures and Parallelism Autumn 2017 Setting Up Your CSE 332 Environment In this document, we will provide information for setting up Eclipse for CSE 332. The first s ection covers using
More informationProject 5 - The Meta-Circular Evaluator
MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Fall Semester, 2005 Project 5 - The Meta-Circular
More informationWelcome to Bootcamp2015 s documentation!
Welcome to Bootcamp2015 s documentation! This website (or pdf) will be home to some resources that will be useful for boot campers and instructors. Lecture notes and assignments for the econ course associated
More informationData Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 18 Tries Today we are going to be talking about another data
More informationUsing git for Homework
Using git for Homework Terry Sergeant 1 Background The program git is an example of distributed version control software. It is used by programmers for the purpose of tracking changes to a code base, especially
More informationGetting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners
Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008
More informationOutline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system
Git A fast distributed revision control system Nils Moschüring PhD Student (LMU) 1 The three W s What? Why? Workflow and nomenclature 2 Overview of gits structure Structure Branches 3 Using git Setting
More informationIntro to Github. Jessica Young
Intro to Github Jessica Young jyoung22@nd.edu GitHub Basics 1. Installing GitHub and Git 2. Connecting Git and GitHub 3. Why use Git? Installing GitHub If you haven t already, create an account on GitHub
More informationDiscussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:
Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;
More informationCIS 194: Homework 5. Due Friday, October 3, Rings. No template file is provided for this homework. Download the
CIS 194: Homework 5 Due Friday, October 3, 2014 No template file is provided for this homework. Download the Ring.hs and Parser.hs files from the website, and make your HW05.hs Haskell file with your name,
More informationWeb API Lab. The next two deliverables you shall write yourself.
Web API Lab In this lab, you shall produce four deliverables in folder 07_webAPIs. The first two deliverables should be pretty much done for you in the sample code. 1. A server side Web API (named listusersapi.jsp)
More informationCSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209
CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System
More information6.001 Notes: Section 15.1
6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationSECTION 2: HW3 Setup.
SECTION 2: HW3 Setup cse331-staff@cs.washington.edu slides borrowed and adapted from Alex Mariakis,CSE 390a,Justin Bare, Deric Pang, Erin Peach, Vinod Rathnam LINKS TO DETAILED SETUP AND USAGE INSTRUCTIONS
More informationCSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment
CSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment This document guides you through setting up Eclipse for CSE 332. The first section covers using gitlab to access
More informationExercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object
CS1046 Lab 5 Timing: This lab should take you approximately 2 hours. Objectives: By the end of this lab you should be able to: Recognize a Boolean variable and identify the two values it can take Calculate
More informationCS61A Notes Week 6: Scheme1, Data Directed Programming You Are Scheme and don t let anyone tell you otherwise
CS61A Notes Week 6: Scheme1, Data Directed Programming You Are Scheme and don t let anyone tell you otherwise If you re not already crazy about Scheme (and I m sure you are), then here s something to get
More informationCISC-124. Casting. // this would fail because we can t assign a double value to an int // variable
CISC-124 20180122 Today we looked at casting, conditionals and loops. Casting Casting is a simple method for converting one type of number to another, when the original type cannot be simply assigned to
More informationHello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications
Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this
More informationProject 5 - The Meta-Circular Evaluator
MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Spring Semester, 2005 Project 5 - The Meta-Circular
More informationIt s possible to get your inbox to zero and keep it there, even if you get hundreds of s a day.
It s possible to get your email inbox to zero and keep it there, even if you get hundreds of emails a day. It s not super complicated, though it does take effort and discipline. Many people simply need
More informationWorking with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47
Working with GIT MNXB01 2017 Florido Paganelli Lund University florido.paganelli@hep.lu.se Florido Paganelli MNXB01-2017 - Working with git 1/47 Required Software Git - a free and open source distributed
More informationLiquibase Version Control For Your Schema. Nathan Voxland April 3,
Liquibase Version Control For Your Schema Nathan Voxland April 3, 2014 nathan@liquibase.org @nvoxland Agenda 2 Why Liquibase Standard Usage Tips and Tricks Q&A Why Liquibase? 3 You would never develop
More information(Refer Slide Time 3:31)
Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 5 Logic Simplification In the last lecture we talked about logic functions
More informationCS 360: Programming Languages Lecture 10: Introduction to Haskell
CS 360: Programming Languages Lecture 10: Introduction to Haskell Geoffrey Mainland Drexel University Thursday, February 5, 2015 Adapted from Brent Yorgey s course Introduction to Haskell. Section 1 Administrivia
More informationProofwriting Checklist
CS103 Winter 2019 Proofwriting Checklist Cynthia Lee Keith Schwarz Over the years, we ve found many common proofwriting errors that can easily be spotted once you know how to look for them. In this handout,
More informationIntroduction to Programming
CHAPTER 1 Introduction to Programming Begin at the beginning, and go on till you come to the end: then stop. This method of telling a story is as good today as it was when the King of Hearts prescribed
More informationXP: Backup Your Important Files for Safety
XP: Backup Your Important Files for Safety X 380 / 1 Protect Your Personal Files Against Accidental Loss with XP s Backup Wizard Your computer contains a great many important files, but when it comes to
More informationSemester 2, 2018: Lab 1
Semester 2, 2018: Lab 1 S2 2018 Lab 1 This lab has two parts. Part A is intended to help you familiarise yourself with the computing environment found on the CSIT lab computers which you will be using
More informationHave the students look at the editor on their computers. Refer to overhead projector as necessary.
Intro to Programming (Time 15 minutes) Open the programming tool of your choice: If you ve installed, DrRacket, double-click the application to launch it. If you are using the online-tool, click here to
More informationPROBLEM SOLVING 11. July 24, 2012
PROBLEM SOLVING 11 COMPUTER SCIENCE 61A July 24, 2012 Today s section will be a kind of Meta-Section, we are going to walk through some medium to hard-ish problems in Scheme, and we will discuss some methods
More informationHow to git with proper etiquette
How to git with proper etiquette Let's start fixing how we use git here in crew so our GitHub looks even more awesome and you all get experience working in a professional-like git environment. How to use
More informationCSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation Spring 2019 Section 2 Development Tools UW CSE 331 Spring 2019 1 Administrivia HW1 done! HW2 due next Tuesday. HW3 out today, deadline upcoming. Everyone should
More informationHomework 6: Higher-Order Procedures Due: 11:59 PM, Oct 16, 2018
Integrated Introduction to Computer Science Klein Homework 6: Higher-Order Procedures Due: 11:59 PM, Oct 16, 2018 Contents 1 Fun with map (Practice) 2 2 Unfold (Practice) 3 3 Map2 3 4 Fold 4 5 All You
More informationHow to Get Your Inbox to Zero Every Day
How to Get Your Inbox to Zero Every Day MATT PERMAN WHATSBESTNEXT.COM It s possible to get your email inbox to zero and keep it there, even if you get hundreds of emails a day. It s not super complicated,
More informationCPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management
CPSC 491 Lecture 19 & 20: Source Code Version Control VCS = Version Control Software SCM = Source Code Management Exercise: Source Code (Version) Control 1. Pretend like you don t have a version control
More informationLecture 1: Overview
15-150 Lecture 1: Overview Lecture by Stefan Muller May 21, 2018 Welcome to 15-150! Today s lecture was an overview that showed the highlights of everything you re learning this semester, which also meant
More informationLearn Linux in a Month of Lunches by Steven Ovadia
Learn Linux in a Month of Lunches by Steven Ovadia Sample Chapter 17 Copyright 2017 Manning Publications brief contents PART 1 GETTING LINUX UP AND RUNNING... 1 1 Before you begin 3 2 Getting to know Linux
More informationGit. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015
Git CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015 1 Lecture Goals Present a brief introduction to git You will need to know git to work on your presentations this semester 2 Git
More informationgit commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b
Git Cheat Sheet Git Basics Rewriting Git History git init Create empty Git repo in specified directory. Run with no arguments to initialize the current directory as a git repository. git commit
More informationLab Exercise 1 Using EGit and JUnit
Lab Exercise 1 Using EGit and JUnit This lab exercise will get you familiar with following: EGit, an Eclipse plug-in to use to a distributed version control system called Git. JUnit, a unit testing framework
More information6.001 Notes: Section 8.1
6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything
More informationVersion control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison
Version control with git and GitHub Karl Broman Biostatistics & Medical Informatics, UW Madison kbroman.org github.com/kbroman @kwbroman Course web: kbroman.org/tools4rr Slides prepared with Sam Younkin
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 2 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation
More informationSECTION 2: Loop Reasoning & HW3 Setup
SECTION 2: Loop Reasoning & HW3 Setup cse331-staff@cs.washington.edu Review: Reasoning about loops What is a loop invariant? An assertion that always holds at the top of a loop Why do we need invariants?
More information(Refer Slide Time: 01.26)
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.
More informationCSCU9B2 Practical 1: Introduction to HTML 5
CSCU9B2 Practical 1: Introduction to HTML 5 Aim: To learn the basics of creating web pages with HTML5. Please register your practical attendance: Go to the GROUPS\CSCU9B2 folder in your Computer folder
More informationCMSC 201 Fall 2018 Lab 04 While Loops
CMSC 201 Fall 2018 Lab 04 While Loops Assignment: Lab 04 While Loops Due Date: During discussion, September 24 th through September 27 th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz)
More informationVersion Control Systems
Nothing to see here. Everything is under control! September 16, 2015 Change tracking File moving Teamwork Undo! Undo! UNDO!!! What strategies do you use for tracking changes to files? Change tracking File
More informationIntroduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum
Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum Table of Contents Preparation... 3 Exercise 1: Create a repository. Use the command line.... 4 Create a repository...
More informationSoftware Development I
6.148 Software Development I Two things How to write code for web apps. How to collaborate and keep track of your work. A text editor A text editor A text editor Anything that you re used to using Even
More informationWelcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1
Welcome to CS61A! This is a course about programming, which is the art and science of constructing artifacts ( programs ) that perform computations or interact with the physical world. To do this, we have
More informationCOMPSCI 220 Programming Methodology Project Assignment 06: Expression Evaluator
COMPSCI 220 Programming Methodology Project Assignment 06: Expression Evaluator Overview In this assignment you will be exercising a number of different techniques that we have studied. In particular,
More informationCS 11 Haskell track: lecture 1
CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of
More informationA Guide to Condor. Joe Antognini. October 25, Condor is on Our Network What is an Our Network?
A Guide to Condor Joe Antognini October 25, 2013 1 Condor is on Our Network What is an Our Network? The computers in the OSU astronomy department are all networked together. In fact, they re networked
More informationCivil Engineering Computation
Civil Engineering Computation First Steps in VBA Homework Evaluation 2 1 Homework Evaluation 3 Based on this rubric, you may resubmit Homework 1 and Homework 2 (along with today s homework) by next Monday
More informationDealer Reviews Best Practice Guide
Dealer Reviews Best Practice Guide What do I do if I get a negative review? Well, the first thing is, don t panic. Negative reviews aren t the end of the world, they actually help build trust and credibility
More informationHow to set up SQL Source Control The short guide for evaluators
GUIDE How to set up SQL Source Control The short guide for evaluators 1 Contents Introduction Team Foundation Server & Subversion setup Git setup Setup without a source control system Making your first
More informationVersion Control with Git ME 461 Fall 2018
Version Control with Git ME 461 Fall 2018 0. Contents Introduction Definitions Repository Remote Repository Local Repository Clone Commit Branch Pushing Pulling Create a Repository Clone a Repository Commit
More information