2 Pages

hw01

Course: CIS 252, Spring 2008
School: Syracuse
Rating:
 
 
 
 
 

Word Count: 528

Document Preview

1 Homework Administrivia Coverage. This homework covers material in Chapters 1 & 2 of Haskell: The Craft of Functional Programming (HCFP). CIS 252 C Introduction to Computer Science First, introduce the folowing Haskell denition: twoHorse :: Picture twoHorse = sideBySide horse (invertColour horse) Now, dene each of the pictures illustrated in Exercises 2.4 and 2.5, using Logistics. This homework is due...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> Syracuse >> CIS 252

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
1 Homework Administrivia Coverage. This homework covers material in Chapters 1 & 2 of Haskell: The Craft of Functional Programming (HCFP). CIS 252 C Introduction to Computer Science First, introduce the folowing Haskell denition: twoHorse :: Picture twoHorse = sideBySide horse (invertColour horse) Now, dene each of the pictures illustrated in Exercises 2.4 and 2.5, using Logistics. This homework is due in the bin in SciTech 3-212 by noon on only twoHorse and the functions dened in the Pictures module (i.e., Friday, January 25. You may work singly or in pairs on this assignment. do not dene any new helper functions). P ROBLEM 2. Write a Haskell function What to turn in. Turn in a hard copy of your source code and a transcript demonstrating convincingly that your code is correct. You should also submit your code (but not the transcript) to the email archive. checker3 :: Picture -> Picture -> Picture such that (checker3 pic1 pic2) returns a 3 3 checkerboard alternatLook here for details on what the grader will be expecting. For this homeing between pic1 and pic2. work, ignore the design recipe stuff, but dont forget putting your names P ROBLEM 3. Write a Haskell function on what you hand in! diag3 :: Picture -> Picture -> Picture such that (diag3 pic1 pic2) returns a 3 3 grid, with the main diagonal (upper left to lower right) containing pic1 and all other spaces You may use any code from lecture that you wish. In fact, I encourage containing pic2. you to do so. However, you should include a note in your comments indicating that you are doing so and specifying which functions you are P ROBLEM 4. Write a Haskell function reusing. You will need to grab a copy of Pictures.lhs to use the Pictures module. (Make sure your browser saves the le under the name Pictures.lhs.) such that (diag4 pic1 pic2) returns a 4 4 grid, with the main diDo not add your code to this le. Instead, keep a copy of this le in the agonal (upper left to lower right) containing pic1 and all other spaces same directory as your homework code. Also, in your homework code containing pic2. include an import Pictures directive at the top of your le. N.B. The solutions for these problems can all be written in a single line P ROBLEM 5. Write a Haskell function or two of Haskell, although possibly requiring the use of a simple helper nestedBox :: Picture -> Picture -> Picture function. If your code is signicantly more complicated than that, then stop, take a deep breath, and look for a simpler solution. such that (nestedBox pic1 pic2) returns a 4 4 grid, with pic2 in the four center spaces and pic1 in all the other spaces. P ROBLEM 1. HCFP, Exercise 2.4 and Exercise 2.5 (page 30) Exercises diag4 :: Picture -> Picture -> Picture Page 1 January 8, 2008 Homework 1 Examples CIS 252 C Introduction to Computer Science The examples below illustrate the proper behavior of the functions. They make use of the denitions of white and horse from the textbook. Main> printPicture (checker3 horse white) .......##......................##... .....##..#...................##..#.. ...##.....#................##.....#. ..#.......#...............#.......#. ..#...#...#...............#...#...#. ..#...###.#...............#...###.#. .#....#..##..............#....#..##. ..#...#...................#...#..... ...#...#...................#...#.... ....#..#....................#..#.... .....#.#.....................#.#.... ......##......................##.... ...................##............... .................##..#.............. ...............##.....#............. ..............#.......#............. ..............#...#...#............. ..............#...###.#............. .............#....#..##............. ..............#...#................. ...............#...#................ ................#..#................ .................#.#................ ..................##................ .......##......................##... .....##..#...................##..#.. ...##.....#................##.....#. ..#.......#...............#.......#. ..#...#...#...............#...#...#. ..#...###.#...............#...###.#. .#....#..##..............#....#..##. ..#...#...................#...#..... ...#...#...................#...#.... ....#..#....................#..#.... .....#.#.....................#.#.... ......##......................##.... Main> printPicture (diag3 horse white) .......##........................... .....##..#.......................... ...##.....#......................... ..#.......#......................... ..#...#...#......................... ..#...###.#......................... .#....#..##......................... ..#...#............................. ...#...#............................ ....#..#............................ .....#.#............................ ......##............................ ...................##............... .................##..#.............. ...............##.....#............. ..............#.......#............. ..............#...#...#............. ..............#...###.#............. .............#....#..##............. ..............#...#................. ...............#...#................ ................#..#................ .................#.#................ ..................##................ .............................##..#.. ...............................##... ...........................##.....#. ..........................#.......#. ..........................#...#...#. ..........................#...###.#. .........................#....#..##. ..........................#...#..... ...........................#...#.... ............................#..#.... .............................#.#.... ..............................##.... Main> printPicture (diag4 horse white) .......##....................................... .....##..#...................................... ...##.....#..................................... ..#.......#..................................... ..#...#...#..................................... ..#...###.#..................................... .#....#..##..................................... ..#...#......................................... ...#...#........................................ ....#..#........................................ .....#.#........................................ ......##........................................ ...................##........................... .................##..#.......................... ...............##.....#......................... ..............#.......#......................... ..............#...#...#......................... ..............#...###.#......................... .............#....#..##......................... ..............#...#............................. ...............#...#............................ ................#..#............................ .................#.#............................ ..................##............................ ...............................##............... .............................##..#.............. ...........................##.....#............. ..........................#.......#............. ..........................#...#...#............. ..........................#...###.#............. .........................#....#..##............. ..........................#...#................. ...........................#...#................ ............................#..#................ .............................#.#................ ..............................##................ ...........................................##... .........................................##..#.. .......................................##.....#. ......................................#.......#. ......................................#...#...#. ......................................#...###.#. .....................................#....#..##. ......................................#...#..... .......................................#...#.... ........................................#..#.... .........................................#.#.... ..........................................##.... Main> printPicture (nestedBox horse white) .......##..........##..........##..........##... .....##..#.......##..#.......##..#.......##..#.. ...##.....#....##.....#....##.....#....##.....#. ..#.......#...#.......#...#.......#...#.......#. ..#...#...#...#...#...#...#...#...#...#...#...#. ..#...###.#...#.....

Textbooks related to the document above:
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Syracuse - CIS - 252
Lab 2: Getting Familiar with Haskell & HugsYou may work singly or in pairs on this lab.CIS 252 C Introduction to Computer ScienceFor more detail on Emacs than provided in this lab: Start up Emacs, go to Emacs's Help menu, select Emacs Tutorial, a
Syracuse - CIS - 252
Homework 10: Turing MachinesCIS 252 < Introduction to Computer ScienceAdministrivia. This homework covers material from Chapter 31 of The For example, if the original input is "abbab#abbab", the nal output should be "Y"; if the original input is
Syracuse - CIS - 453
SRS TOC0. TOC Main TOC 1. Introduction 1. Purpose 2. Scope 3. Definitions, acronyms, and abbreviations 4. References 5. Overview 2. General description 1. Product perspective 2. Product functions 3. User characteristics 4. Game objectives 5. General
Syracuse - CIS - 655
Sun Fire T2000 Server OverviewSun Microsystems, Inc. www.sun.comPart No. 819-2543-11 April 2006, Revision A Submit comments about this document at: http:/www.sun.com/hwdocs/feedbackCopyright 2006 Sun Microsystems, Inc., 4150 Network Circle, San
Syracuse - CIS - 554
Before function calls:a= 5 b= 10At end of badswap, before return:x= 10 y= 5After call to badswap:a= 5 b= 10At end of goodswap, before return:x= 10 y= 5After call to goodswap:a= 10 b= 5At end of badswap, before return:x= 50 y= 2Befor
Syracuse - SC - 504
Introduction to Programming in C+Class 8 02/12/2003 Rohit ValsakumarCharacter I/OAll data is input or output in the form of charactersIf the program expects a integer input then the character stream received from the input is automat
Syracuse - SC - 504
IntroductiontoProgramming inC+Class22 04/17/2003 RohitValsakumarMultipleInheritance Aclasscanbederivedfrommorethanoneclass Thisiscalledasmultipleinheritance ThesyntaxisasgivenbelowclassA /BaseclassA {. }; classB /BaseclassB { }; classC:public
Syracuse - SC - 196
CPS 196 Introduction to Computer Programming: CMemory, Addresses Function declarations Function calls scanf OverviewMemory Addresses Function declaration, call scanf MemoryPart of the computer that holds data and instructions
Syracuse - SC - 504
CIS504CIS 504 U001 Introduction to Programming: C+ Rohit Valsakumar sc504a@ecs.syr.edu SPRING 2003 Lab 11CIS5041CIS504LAB 11Overloading:Write a program that contains and does the following: A) Create a class called "Complex" for performi
Syracuse - SC - 504
CIS504CIS 504 U001 Introduction to Programming: C+ Rohit Valsakumar sc504a@ecs.syr.edu SPRING 2003 Lab 6CIS5041CIS504Complete the following program and make sure that every function works as expected Only a bare skeleton is provided for eac
Syracuse - SC - 196
LECTURE 5 DATA OUTPUTputchar FUNCTIONSingle characters can be displayed using the C library function putchar. The putchar function is complementary to the getchar function. The putchar transmits a single character to the standard output device. It
Syracuse - CSE - 773
(* file ~/public_html/cse773/README.txt, L. Morris, 1/8/03 *)This subdirectory of my public_html is intended to make relevant textualmaterial which I have written, and may want to revise from time to time,accessible to students in CSE 773, Spring
Wyoming - WYO - 4
Wyoming 4-H is.open to youths ages 8 to 19.Where to find Wyoming 4-H.County Albany Big Horn Campbell Carbon Converse Crook Fremont Goshen Hot Springs Johnson Laramie Lincoln Natrona Niobrara Park Platte Sheridan Sublette Sweetwater Teton Uinta Wa
Syracuse - JPTHOM - 01
TaxAppendixTable1.Topmarginalstateincometaxrateonwages1988 3.65 0 5.41 7 9.3 4.76 0 7.7 0 5.66 9 8.2 2.5 3.4 7.39 3.87 4.39 4.14 8 5 5 4.6 8 4.75 4.39 9.02 5.9 0 0 3.5 7.83 8.38 7 3.77 6.55 5.64 9 2.1 6.04 7 0 0 0 6.58 6.05 5.75 0 9.5 6.5 6.93 0 198
Syracuse - MAT - 121
Problems from Section 6-5 of the text-8. Find the margin of error: n = 777, x = 543, 90% confidence.12. Construct the confidence interval estimate of the population proportionp: n = 1200, x = 800, 90% confidence.16. Use the given information
Syracuse - MAT - 19
Problems from Section 6-5 of the text-8. Find the margin of error: n = 777, x = 543, 90% confidence.12. Construct the confidence interval estimate of the population proportionp: n = 1200, x = 800, 90% confidence.16. Use the given information
Syracuse - MAT - 121
Problems from section 4-4-6. Several students were unprepared for a multiple-choice quiz with 20questions, and all of their answers were guesses. Each question has five possible answers, and only one of them is correct.a. find the mean and sta
Syracuse - MAT - 121
Binomial Distribution Problem from Text-26)The rates of on-time flights for commercial jets are continuously trackedby the U.S.Department of Transportation. Recently, Southwest Air had thebest rate with 80% of its flights arriving on time. A tes
Syracuse - PHY - 312
PHY312 - Homework 31. An object of mass 3 kilograms moves 8 meters along the x-direction in in 3 108 secs as measured in the laboratory. What is its energy and momentum ? Its rest energy ? Its kinetic energy ? What value of the kinetic energy would
Syracuse - PHY - 101
Outline PHY 101 Lecture #9: Series Circuit, Parallel Circuit, and Capacitorshttp:/physics.syr.edu/courses/PHY101/ Off. Hrs: Tue 9:30 11:00, Physics 263-4 Prof. Schwarzs Problem Sessions: Mon and Tues, 5:15 6:15, Physics 202/2041. Series circuit 2
Syracuse - PHY - 212
Syracuse - PHY - 101
PHY 101 Lecture #6: Simple Harmonic Oscillators, and Electrical PhenomenaProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/courses/PHY101/ Off. Hrs: Tue 9:30 11:00, Physics 263-4 Prof. Schwarzs Problem Sessions: Mon and Tues, 5:15
Syracuse - PHY - 212
Syracuse - PHY - 101
9/20/2008Newton's LawsSummary of Newton's Laws Second Law: First Law: a0 Fi ma Third Law: For every action force, there is an equal and opposite reaction force.http:/cartoonstock.com/directory/N/Newton.aspThird LawBus and the bugC
Syracuse - PHY - 101
PHY 101 Lecture #7: Electrical Charges, Forces, and FieldsProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/courses/PHY101/ Office Hrs: Tues 10 11:30, Physics 263-4, 3-5994PHY 101 Lecture #7 Electrical Charges, Forces, and Fields
Syracuse - PHY - 772
INVASIONS IN PARTICLE PHYSICSCompton Lectures Autumn 2001 Lecture 5 Nov 3 2001http:/hep.uchicago.edu/compton 1LECTURE 4 The accelerator invasion2Particle Physics Related Accelerators Listing345Proposed Linear Electron Colliders : NLC
Syracuse - PHY - 101
11/24/2008Heat enginesWhat does REALLY temperature mean? Molecules of a gas bounce off the walls of a container Recoil pushes outward on the walls Pressure depends on the kinetic energy of molecules The average kinetic energy per "simple" mol
Syracuse - PHY - 211
Welcome back to Physics 211Today's agenda: Announcements Velocity and acceleration in two-dimensional motion Motion under gravityPhysics 211 Fall 2003Lecture 03-11ReminderHomework due this week: Tues/Wed: Tutorial Homework on Accelerat
Syracuse - PHY - 211
Suppose a tennis ball and a bowling ball are rolling toward you. Both have the same momentum (mv), and you exert the same force to stop each. It takes equal time intervals to stop each ball. The distance taken for the bowling ball to stop is 1.less
Syracuse - PHY - 101
PHY 101 Lecture #7: Electrical CircuitsProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/course/PHY101/ Office Hrs: Tues 10 -12, Physics 263-4, 3-5994PHY 101 Lecture #7 Electrical circuits 1Outline1. Intuition about voltage an
Syracuse - PHY - 101
Outline PHY 101 Lecture #9: Parallel Circuit, Capacitors, and Electrical PowerProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/courses/PHY101/ Office Hrs: Tues 9:30 -11:30, Physics 263-4, 3-5994PHY 101 Lecture #9 Parallel Circui
Syracuse - PHY - 361
Interference and Diffraction PatternsAn in-class activity to investigate interference and diffraction of light wavesSeptember 6, 2005Print Your Name _ Print Your Partner's Name _ __ _ _ You will return this handout to the instructor at the end of
Syracuse - PHY - 2005
Phy 361 Modern PhysicsFall 2005Homework Assignment 1Due Tuesday, 9/6/05Name . . . . . . . . . . . . . . . . . . . .Please fill your answers on these pages and turn in the whole handout. Announcement: On Tuesday, September 6, we will do a spe
Syracuse - PHY - 2005
Phy 361 Modern PhysicsFall 2005Homework Assignment 1Due Tuesday, 9/6/05Name. KEY . . . . . . . . . . .Please ll your answers on these pages and turn in the whole handout. Announcement: On Tuesday, September 6, we will do a special in-class a
Syracuse - PHY - 361
Phy 361 Modern PhysicsFall 2005Homework Assignment 1Due Tuesday, 9/6/05Name. KEY . . . . . . . . . . .Please ll your answers on these pages and turn in the whole handout. Announcement: On Tuesday, September 6, we will do a special in-class a
Syracuse - PHY - 101
Outline PHY 101 Lecture #6: Electrical PhenomenaProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/courses/PHY101/ Office Hrs: Tues 9:30 11:30, Physics 263-4, 3-5994PHY 101 Lecture #6 Electrical Phenomena 1 PHY 101 Lecture #6 Elec
Syracuse - PHY - 102
PHY102 Lab #5 Mon. 2/12/02 The Maxwell-Boltzman ShufflePrep: Sort balls, write numbers on board Equipment: 1 6-sided die for every 2 students, 1 100-sided die for every 2 students, 50 numbered wooden cubes or balls, and 11 bins numbered 0-10. Impor
Syracuse - PHY - 101
PHY 101 Lecture #2: ForcesPHY 101 Lecture #2Forces1OutlineDefinition of forceSprings and spring scalesFundamental forcesGravitational force Electrical force OthersHidden versions of the electric force How force affects motionF=maPHY
Syracuse - PHY - 101
Outline PHY 101 Lecture #23: Efficiency of Heat EnginesProf. Peter R. Saulson saulson@physics.syr.eduhttp:/physics.syr.edu/courses/PHY101/ Office Hrs: Tues 9:30 -11:30, Physics 263-4, 3-5994PHY 101 Lecture #23 Efficiency of Heat Engines 1 PHY 101
Syracuse - PHY - 211
Welcome back to Physics 211Today's agenda: More on Newton's Laws Read ch. 8 Review tonight 6:00 Stolkin Exam 2 Thursday 10/23 OH W 3 4 Room 329Physics 211 Fall 2008Lecture 9-1Demos Pasco cars Equal masses Unequal masses 1 student +
Wyoming - EE - 2390
EE 2390 Chapter 6 Verilog ExamplesIRILExample 6.1: 4-bit universal shift register135791113151719/ Behavioral description of a 4- bit universal shift register / Fig . 6.7 and Table 6.3 module Shift_Register_4_beh ( / V2001 ,
Wyoming - EE - 2390
Features Industry-standard Architecture 12 ns Maximum Pin-to-pin Delay Zero Power 25 A Maximum Standby Power (Input Transition Detection) CMOS and TTL Compatible Inputs and Outputs Advanced Electrically-erasableTechnology Reprogrammable 100
Wyoming - CE - 2100
Wyoming - CE - 5820
Dam Safety Program, IDF, Spillway Requirements and Proposed Rule ChangesCWCB/SEO Workshop February 2, 2005Jack G. Byers Deputy State EngineerReservoir StorageCurrent Storage Restricted Storage* Total a-f (#dams)Division 1 Division 2 Division
Wyoming - EE - 2390
Intro to Verilog HDL Chapter 3If we implement this circuit in Verilog: /HDL Example 3-1 /-/Description of the simple circuit of Fig. 3-37 module smpl_circuit(A,B,C,x,y); input A,B,C; output x,y; wire e; and g1(e,A,B); not g2(y,C); or g3(x,e,y); end
Wyoming - CE - 2100
An Introduction toAutoCAD in Civil Engineering PracticeCE 2100 Introduction to Civil Engineering SystemsThomas V. Edgar, P.E., Ph.D.Department of Civil and Architectural Engineering University of Wyoming Laramie, WY 82072Fall, 2008Introdu
Wyoming - CE - 2100
Wyoming - CE - 5820
Project Planning17tIn certain sections of the United States, water rights are commonly overlooked. Although no difficulties may have arisen in the past on a particular stream or in a particular area, water rights must be investigated for eachpr
Wyoming - EE - 2390
EE 2390 Chapter 4 Verilog ExamplesFall 2004One of the biggest jumps in productivity for digital designers was provided by Hardware Description Languages (HDLs) such as Verilog, VHDL, CUPL, ABEL, etc. Verilog and VHDL are evenly split on about 90%
Wyoming - EE - 2390
Connecting the new parallel port Xilinx cable to the EVB: EE2390 EVBgreen LED 1 7-segment displays 44edge pinsedge pinsXilinx 9510822TMS (purple) N.C. TDI (orange) TDO (green) TCLK (yellow) N.C. GND (black) Vcc (red)23connect to these
Wyoming - EE - 5630
Parallel beam CT projection data of Shepp-Logan head phantomFrom a CT system using a parallel-beam geometry127 rays each rotated through 110 angles that span 180 degrees (pi radians)Assume tau=1/63Use fopen(), fscanf(), and fclose() in MATL
Wyoming - ES - 1000
Example Research Questions Geothermal 1. Can Wyoming's geothermal resources be cost-effectively harnessed for energy? Green and Sustainability 2. In the fields of structural and architectural engineering, being green is being encouraged by the LEED G
Syracuse - INTLSECURI - 2008
Page 11 of 1 DOCUMENTForeign Affairs May 2006 - June 2006The Long War Against CorruptionBYLINE: Ben W. Heineman, Jr., and Fritz Heimann SECTION: Pg. 115 Vol. 85 No. 3 LENGTH: 2280 wordsA WAYS TO GO Since the mid-1990s, the issue of corruptio
Syracuse - INTLSECURI - 2008
This article was downloaded by:[Syracuse University] On: 18 January 2008 Access Details: [subscription number 750568702] Publisher: Routledge Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37
Wyoming - WYO - 4
Wyoming 93503-00The 4-H President and Vice PresidentThe president is the chief officer and takes the lead in all club affairs. Directing business meetings and checking on the progress of committee work are presidential responsibilities. While some
Wyoming - WYO - 4
Table of ContentsHorticultural and Consumer Qualities . 2 Vegetable Names, Spellings, and Descriptions . 2 Correct Spellings of Vegetable Names . 3 Vegetable Descriptions, Merits, and Faults . 3 Judging Point Scale.. 11 Vegetable Terms to Remember .
Wyoming - WYO - 4
Wyoming 93512-004-H CeremoniesCeremonies help describe the meaning of 4-H work. Through them, 4-H ideals may be highlighted with dignity and beauty. Well-planned ceremonies create a closer bond among members within a club and throughout the countr
Wyoming - WYO - 4
Wyoming 93509-00The 4-H ParliamentarianPrepared by .rank Henderson, University of Wyoming Extension Educator, Converse CountyYou Tips You Should Know_ _ _ _ _Speak so everyone can hear you. Always move to the front of the group when leading a