This website uses cookies to ensure you have the best experience. Learn more

Cs Functional Prog. Writeup Essay

1444 words - 6 pages

Data Structures and Functional Programming CS 3110, Fall 2013 Version: 6

Problem Set 4 Due at 11:59 PM, Thursday, October 17 Last Modified: October 22, 2013

Instructions
Compile Errors
All code you submit must compile. Programs that do not compile will be heavily penalized. If your submission does not compile, we will notify you immediately. You will have 48 hours after the submission date to supply us with a patch. If you do not submit a patch, or if your patched code does not compile, you will receive an automatic zero.

Naming
We will be using an automatic grading script, so it is crucial that you name your functions and order their arguments according to the problem set ...view middle of the document...

The GUI for this problem set requires some additional OCaml libraries; the file README.txt in the release contains instructions for compiling and running the project. 1

Introduction
In many applications, users want to rearrange a collection of geometric shapes while keeping them from overlapping with each other. For example, users like to rearrange windows on their desktops while keeping each window entirely visible. Without an automated way to keep them from overlapping, users must carefully adjust the boundaries of the windows if they want to avoid large gaps between the windows. The same user interface feature is useful in other applications, such as computer aided design, graphics applications, and games. In this assignment, you will be building a library that allows users to drag and drop shapes while keeping them from intersecting each other. You will use the library to build a simple “tangrams” game. The correctness of geometric algorithms depends on the properties of the numbers used to represent the coordinates of the shapes. You will implement a variety of number types to investigate the tradeoffs of various representations. Finally, this assignment contains a small problem related to mutability.

Part One: Numbers
For this portion of the assignment, you will implement a variety of modules, each defining a representation of a set of numbers and the operations available for those numbers. Your number modules will each implement one of the following interfaces (we have provided these signatures in numbers.ml): • A Quotient represents a set of elements, which we will refer to as numbers. The only operation provided by Quotient is the (===) function, which defines the notion of equality for the set of numbers. • Just as Quotient defines a notion of equality between numbers, Group defines a notion of addition. In addition to the (+) operation, Group requires a number called zero, and for each number x, an additive inverse -x . Note that OCaml writes the negation operation as (~-). That is, (~-) x is the same as -x. • Ring extends Group by adding a notion of multiplication. It also requires a multiplicative identity called one. • A Field is a ring where every number x has a multiplicative inverse x −1 . This allows us to define division: x/y is just x y −1 . • OrderedRing and OrderedField add a notion of ordering to rings and fields respectively. We only require implementors to provide a function that determines if a number is negative, but comparison operations like () can be defined in terms of is_non_neg (you will do this in exercise 2 below). • NiceRing and NiceField require additional useful functions: the ability to convert a number to an OCaml float, and a function for printing a number onto the console. You can 2

register these formatting functions with the OCaml toplevel using the #install_printer command; this will cause the toplevel to use that function to print out values of your number type. See the toplevel documentation...

Other Papers Like Cs Functional Prog. Writeup

A Heart Of Darkness Essay

1748 words - 7 pages In this short story, there are frequent significant subject and ideas that make the story, "A Heart of Darkness," by Joseph Conrad, and haunting novel. The main theme is absolute white power over the natives. The theme validates the corruption, and the dependence caused by the white people as they took over the Congo. White men were giving all the power; they had no self-control, and in the end they did not use wisely. The white men became

The Aspects Of Vulnerability Among The Exploited In Medical Research

2287 words - 10 pages Essentially, everyone is in some state of vulnerability. However, some of us are more susceptible to harm due to our vulnerabilities. The susceptible are the individuals with the greatest risk. These individuals risk the loss of their autonomy, and maybe even their lives. Vulnerable populations can be found in every subset of society. However, as previously mentioned, there are some vulnerable populations that are at an even greater risk than

The Hitchhiker’S Guide To The Galaxy

1171 words - 5 pages The Hitchhiker’s Guide to the Galaxy As the human race makes life-changing discoveries, it is made apparent that there is always more to learn as the universe, instead of becoming familiar, is becoming absurd. The Hitchhiker’s Guide to the Galaxy, written by Douglas Adams, as well as the 2005 film adaption, portrays absurdity to be an all-encompassing system in the universe. Through the introduction and attempt to understand lack of reason, the

The Ford Motor Company Wage Increase Of 1914 And The Theory Of Incentives And Efficiency Wages

1252 words - 6 pages ‘It’s not the employer who pays the wages. Employers only handle the money. It is the customer who pays the wages’ (Henry Ford, cited in Johnson and Weinstein 2004, p. 2). When the Ford Motor Company announced that it would more than double the wages of its workers in January 1914 to a ‘five-dollar day’ minimum, was this a contradiction to Henry Ford’s statement? If customers are actually the ultimate payers of wages, then more than

Historical Analysis Of The Economical Breakthroughs Of The Industrial Revolution

1396 words - 6 pages A Historical Analysis of the Economical Breakthroughs of the Industrial Revolution During the Industrial Revolution, many elements of society experienced huge breakthroughs that would change the way they functioned forever. Economics were definitely one of them. With many new inventions and many factories appearing, many, many, more resources were being created than ever before. Also, all of the revenue from these resources was being given to

Leadership Portrayed in Monologue from Shakespeare’s Henry V

1214 words - 5 pages Leadership is defined as a socially constructed process and which also affect organizational future outcomes. Leader is someone at high position who have overall duty for an organization, she or he decide what to do and the way how to achieve it. (Carter and Greer, 2013)The role of leader is extremely important for an organization, leader use their own power to influence the followers though many different ways such as motivation in order to

Cuba Civil Rights

1906 words - 8 pages Picture a country that has limits on how much you can make random government imprisonments and more what do you do. That is the situation for the eleven million seventy-five thousand two hundred forty-four people of Cuba since the takeover of Fidel Castro. The US is opposed to Castro taking control of Cuba. Castro managed to ease the United States nerves when he said that Cuba was against all forms of communism. According to Lana Wylie the Union

US Freight System

1273 words - 6 pages General Environment Each American requires the movement of approximately 40 tons of freight per year across the freight network. This includes everything from shirts to lawn mower to orange juice. • As the U.S. population expands, the U.S. freight system will be called upon to meet the demands of a larger population • Between 2010 and 2035, the system will experience a 22 percent increase in the total amount of tonnage it moves • By 2050, with

Democratic Peace Theory

1852 words - 8 pages Intro: US Presidents have made it a goal during their term(s) in office to establish a good relationship with foreign countries and even try to improve upon existing connections with our allies. Some believe it is to prevent conflicts between the countries while others dispute that it is a threat assessment by the United States to pick and choose their friends and enemies. Preventing conflict between two democracies or countries that practice

Booker T. Washington

1621 words - 7 pages “Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome” –Booker T. Washing. Booker Taliaferro Washington was born in Hale’s Ford, Virginia on April 5th, 1856 to Jane Burroughs and an unknown White man. Washington was married three times. His first wife was Fannie N. Smith from Malden, West Virginia. Booker and Fannie were married in the summer of 1882 and had one child

Corn, Broccoli, Grass Or Balanced

2611 words - 11 pages animals are provided with opportunity to articulate their characteristic form of life, and ultimately be happy. To fix something, you have to un-break it. In the case of the industrial food system, where it tried to fix or advanced the nature confided food system that was and still is if giving the opportunity very functional. The side effects of the modern food system have been lethal to the environment, with CAFOs and feedlots driving this train

Related Essays

Freedom And Responsibility Essay

2141 words - 9 pages Built within the Constitution of the United States are specifically defined freedoms that are guaranteed to all citizens. Conversely, with every constitutional freedom there comes a corresponding responsibility. On September 25, 1789, the state legislature’s twelve proposed amendments were transmitted by congress, the first two dealing with congressional representation and congressional pay. The following numbers three through twelve were

Hate Crime Laws Essay

2348 words - 10 pages On June 7, 1998, 49-year-old James Byrd Jr. of Texas accepted a ride from three white men, who then beat him severely, urinated on him, chained him by his ankles to the back of their pick-up truck, dragged him for three miles into the countryside, and dumped his corpse in front of an African-American cemetery (Graczyk). A little over a year later, a jury sentenced ring leader John King to death by lethal injection (“Man Executed for Dragging

Rational Emotional Behavior Therapy Case Study Conceptualization And Treatment Plan

2140 words - 9 pages A activates her B which then causes her Cs, also shown by the equation A x B = C, and that all three factors are interrelated (Murdock, 2009). Sarah must learn to practice UAO, unconditional acceptance of others, and ULA, unconditional life acceptance, in order to achieve a life of minimal disturbance (Murdock, 2009). Murdock (2009) explains that REBT recognizes people as carrying goals throughout their life and it is when these goals are

Holidays In Albania Essay

1636 words - 7 pages Have you ever thought about having exciting and incredibly cheap vacations? Albania might be the right choice. According to My Travel Guide, Albania is ranked the fourth among ten places worth visiting in Eastern Europe (“Top 10 Eastern European Destinations”). One can encounter three kinds of vacations in this Mediterranean country: winter, summer, and cultural. The ideal places to spend your winter vacations are the Albanian Alps. They are