CSC302 2011S Programming Languages
[Skip to Body]
Admin:
[Front Door]
[Schedule]
[Handouts]
[Honesty]
[Piazzza]
Current:
[Current Outline]
[Current EBoard]
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Languages:
[Clojure]
[Erlang]
[Haskell]
[Io]
[Prolog (GNU)]
[Ruby]
[Scala]
Misc:
[SamR]
[CSC302 2007S]
[7L7W]
Summary: We conclude our exploration of the Scala programming language, focusing on its XML, pattern matching, and concurrency features.
Prerequisites: The first Scala lab.. The second Scala lab. Tate, Sections 5.4 and 5.5.
Contents:
a. Create a directory for the lab.
b. Open a browser window on Tate's examples, in case you want to try any of them.
a. Try Tate's movies/shorts
example, from the section entitled XML with Matching
.
b. Write an expression to print just the shorts in the collection of movies.
c. To the full movies, add subsections for chapters. E.g.,
<movie>The Incredibles
<chapter>Opening</chapter>
<chapter>Heroes in Love</chapter>
<chapter>Oh No! It's the bad guy.</chapter>
</movie>
d. What do you expect the effect to be if you run Tate's foreach
matching expression using this expanded collection?
e. Check your answer experimentally?
f. To the list of movies, add a series type. E.g.,
<series>Glee, Season 1</series>
g. What do you expect the effect to be if you run Tate's foreach
matching expression using this expanded collection?
h. Check your answer experimentally.
Here is a sketch of a simple HTML page.
<html> <head> <title>A Sample Page</title> </head> <body> <h1><a name="top">A Sample Page</a></h1> <h2><a name="sect1">Section 1</a></h2> <h2><a name="sect2">Section 2</a></h2> </body> </html>
Write instructions to generate a simple table of contents
for
this page. That is, for each anchor target, you should generate a
link. The result of this might be:
<ul> <li><a href="#top">A Sample Page</a></li> <li><a href="#sect1">Section 1</a></li> <li><a href="#sect2">Section 2</a></li> </ul>
It would, of course, be better to generate a hierarchical table of contents. However, that might be significantly more work and places more assumptions on the structure of the original.
Write a script that takes an HTML page and prints out all of the links in that page.
a. Try Tate's algorithm for figuring out the sizes of a group of pages.
b. See if you can figure out a way to get a sum of sizes out of the algorithm.
Write a script that takes an HTML page and prints out the size of all the linked files in that page. Make sure that you fetch the linked files concurrently.
If you find yourself with extra time, continue working on Assignment 5.
Tuesday, 22 February 2011 [Samuel A. Rebelsky]
Wednesday, 23 February 2011 [Samuel A. Rebelsky]
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC302/2011S/Labs/scala-2.html.
[Skip to Body]
Admin:
[Front Door]
[Schedule]
[Handouts]
[Honesty]
[Piazzza]
Current:
[Current Outline]
[Current EBoard]
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Languages:
[Clojure]
[Erlang]
[Haskell]
[Io]
[Prolog (GNU)]
[Ruby]
[Scala]
Misc:
[SamR]
[CSC302 2007S]
[7L7W]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Apr 25 08:06:55 2011.
The source to the document was last modified on Wed Feb 23 08:51:12 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC302/2011S/Labs/scala-3.html.
A PDF version of this document may be found at
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC302/2011S/Labs/scala-3.pdf
You may wish to
validate this document's HTML
;
;