Skip to content

Commit 256db8a

Browse files
committed
update webpage
1 parent b024617 commit 256db8a

15 files changed

+874
-1547
lines changed

Makefile

+18-32
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,26 @@
1-
RSYNC=$(shell pwd)/sync.sh
2-
3-
SITEPATH=/cse/htdocs/classes/wi15/cse230-a
4-
remotehost=login.eng.ucsd.edu
5-
remotedir=/cse/htdocs/classes/wi15/cse230-a
1+
GHPAGE=../../230-gh-pages/
62

7-
PANDOCHANDOUT=pandoc --highlight-style=tango --from=markdown+lhs --chapters --latex-engine=pdflatex --template=templates/handout.latex --filter templates/inside.hs
3+
full: site lectures
84

9-
lhsObjects := $(wildcard lectures/*.lhs)
10-
pdfObjects := $(patsubst lectures/%.lhs,pdf/%.pdf,$(wildcard lectures/*.lhs))
11-
12-
all: website
13-
stack exec -- website rebuild
14-
cp css/syntax-rj.css _site/css/syntax.css
15-
cp lectures/*.lhs _site/lectures/
16-
cp -p -r slides _site/
17-
cp homeworks/*.lhs _site/homeworks/
18-
cp final/*.lhs _site/final/
19-
20-
website: src/Site.hs
5+
site:
216
stack build
7+
stack exec -- homepage rebuild
228

23-
clean:
24-
rm -rf *.hi *.o .*.swp .*.swo website _site/ _cache/
25-
26-
rsync:
27-
$(RSYNC) _site/ $(remoteuser) $(remotehost) $(remotedir)
28-
29-
update: build
30-
scp -r _site/* $(SITEUSER):$(SITEPATH)
31-
ssh $(SITEUSER) "chmod -R g+w $(SITEPATH) && chmod -R ugo+r $(SITEPATH)"
9+
lectures:
10+
cd lectures && make && cd ..
11+
cp css/syntax-rj.css _site/css/syntax.css
12+
cp -p -r lectures _site/
3213

33-
slides:
34-
cd slides && make && cd ..
14+
upload: site lectures
15+
cp -r _site/* $(GHPAGE)
16+
cd $(GHPAGE) && git add . && git commit -a -m "update page" && git push origin gh-pages
3517

36-
handouts: $(pdfObjects)
3718

38-
pdf/%.pdf: lectures/%.lhs
39-
-$(PANDOCHANDOUT) $? -o $@
19+
clean:
20+
rm -rf *.hi *.o .*.swp .*.swo website _site/ _cache/
4021

22+
final:
23+
mkdir final
24+
cp -R ~/liquid-cache *.lhs final/
25+
tar czf final.tar.gz final
26+
rm -r final

assignments.markdown

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ title: Assignments
66
atomic units over the entire quarter. By "atomic" I mean, for example, that
77
35 mins over the deadline is equal to 1 late day.
88

9-
- [Homework #1](homeworks/Hw1.html), due 23.59.59 PST on Monday 1.26.2015
9+
10+
- [Homework #1](homeworks/Hw1.html), due 23.59.59 PST on Monday 1.25.2016
11+
12+
<!---
1013
- [Homework #2](homeworks/Hw2.html), due 23.59.59 PST on Friday 2.13.2015
1114
- [Homework #3](homeworks/Hw3.html), due 23.59.59 PST on Monday 3.2.2015
1215
13-
<!---
1416
- [Homework #4](homeworks/hw4.html), due Friday, 3.8.2014
1517
- [Final](homeworks/final.html) , due Friday, March 23
1618
-->

homeworks/Hw1.lhs

+69-53
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,52 @@
11
---
2-
title: Homework #1, Due Monday 1/26/15
2+
title: Homework #1, Due Monday 1/25/15
33
---
44

5+
Preliminaries
6+
-------------
7+
8+
Before starting this assignment:
9+
10+
1. Download and install [Stack](http://docs.haskellstack.org/en/stable/README.html#how-to-install)
11+
2. Download the assignment [code bundle](/static/hw1.tar.gz).
12+
3. Unpack bundle `tar -zxvf hw1.tar.gz`
13+
3. Verify that things build etc. by:
14+
15+
~~~
16+
$ stack build
17+
... ( wait for a long time )
18+
$ stack ghci Hw1
19+
...
20+
*Hw1> :l SOE/src/Draw.lhs
21+
...
22+
*Draw> main0
23+
~~~
24+
25+
You should see a window with some shapes in it. Now if you do:
26+
27+
~~~
28+
> :l Main.hs
29+
> main
30+
~~~
31+
32+
You should get an exception:
33+
34+
~~~
35+
*** Exception: Define me!
36+
~~~
37+
38+
Interacting with GHCi
39+
---------------------
40+
41+
1. Keep open a `ghci` (by running `stack ghci Hw1` in the command prompt),
42+
2. Load `Hw1.hs` by typing `:l Hw1.hs`
43+
3. Edit `Hw1.hs` to implement the various functions,
44+
4. After each edit, to test your code, do `:r` and test the function.
45+
46+
There are fancy modes for various editors (vim, emacs, atom, sublime)
47+
that make the above even smoother. Feel free to investigate to your taste.
48+
49+
550
Haskell Formalities
651
-------------------
752

@@ -22,40 +67,10 @@ strings below
2267
> myEmail = "Write Your Email Here"
2368
> mySID = "Write Your SID Here"
2469

25-
26-
Preliminaries
27-
-------------
28-
29-
Before starting this assignment:
30-
31-
* Download and install the [Haskell Platform](http://www.haskell.org/platform/).
32-
* Download the [SOE code bundle](/static/SOE-cse230.tar.gz).
33-
34-
* Verify that it works by changing into the `SOE/src` directory and
35-
running `ghci Draw.lhs`, then typing `main0` at the prompt:
36-
37-
~~~
38-
cd SOE/src
39-
ghci Draw.lhs
40-
*Draw> main0
41-
~~~
42-
43-
You should see a window with some shapes in it.
44-
45-
**NOTE:** If you have trouble installing SOE, [see this page](soe-instructions.html)
46-
47-
5. Download the required files for this assignment: [hw1.tar.gz](/static/hw1.tar.gz).
48-
Unpack the files and make sure that you can successfully run the main program (in `Main.hs`).
49-
We've provided a `Makefile`, which you can use if you like. You should see this output:
50-
51-
~~~
52-
Main: Define me!
53-
~~~
54-
5570
Part 1: Defining and Manipulating Shapes
5671
----------------------------------------
5772

58-
You will write all of your code in the `hw1.lhs` file, in the spaces
73+
You will write all of your code in the `Hw1.hs` file, in the spaces
5974
indicated. Do not alter the type annotations --- your code must
6075
typecheck with these types to be accepted.
6176

@@ -66,8 +81,8 @@ The following are the definitions of shapes:
6681
> | RtTriangle Side Side
6782
> | Polygon [Vertex]
6883
> deriving Show
69-
>
70-
> type Radius = Float
84+
>
85+
> type Radius = Float
7186
> type Side = Float
7287
> type Vertex = (Float, Float)
7388

@@ -76,10 +91,10 @@ The following are the definitions of shapes:
7691
built with the Polygon constructor.
7792

7893
> rectangle :: Side -> Side -> Shape
79-
> rectangle = error "Define me!"
94+
> rectangle = error "Define me!"
8095

8196
> rtTriangle :: Side -> Side -> Shape
82-
> rtTriangle = error "Define me!"
97+
> rtTriangle = error "Define me!"
8398

8499
2. Define a function
85100

@@ -104,15 +119,15 @@ The following are the definitions of shapes:
104119
To solve the puzzle, you must move all the discs from the starting peg
105120
to another by moving only one disc at a time and never stacking
106121
a larger disc on top of a smaller one.
107-
122+
108123
To move $n$ discs from peg $a$ to peg $b$ using peg $c$ as temporary storage:
109-
124+
110125
1. Move $n - 1$ discs from peg $a$ to peg $c$.
111126
2. Move the remaining disc from peg $a$ to peg $b$.
112127
3. Move $n - 1$ discs from peg $c$ to peg $b$.
113-
128+
114129
Write a function
115-
130+
116131
> hanoi :: Int -> String -> String -> String -> IO ()
117132
> hanoi = error "Define me!"
118133

@@ -123,7 +138,7 @@ The following are the definitions of shapes:
123138

124139
should emit the text
125140

126-
~~~
141+
~~~
127142
move disc from a to c
128143
move disc from a to b
129144
move disc from c to b
@@ -192,12 +207,12 @@ Now write a *non-recursive* version of the above.
192207
`addEachPair [(1,2), (20,21), (300,301)]` should return `[3,41,601]`
193208

194209
> addEachPair :: [(Int, Int)] -> [Int]
195-
> addEachPair = error "Define me!"
210+
> addEachPair = error "Define me!"
196211

197212
Now write a *non-recursive* version of the above.
198213

199214
> addEachPairNonRecursive :: [(Int, Int)] -> [Int]
200-
> addEachPairNonRecursive = error "Define me!"
215+
> addEachPairNonRecursive = error "Define me!"
201216

202217
`minList` should return the *smallest* value in the list. You may assume the
203218
input list is *non-empty*.
@@ -232,7 +247,7 @@ So: `fringe (Branch (Leaf 1) (Leaf 2))` should return `[1,2]`
232247
> fringe :: Tree a -> [a]
233248
> fringe = error "Define me!"
234249

235-
`treeSize` should return the number of leaves in the tree.
250+
`treeSize` should return the number of leaves in the tree.
236251
So: `treeSize (Branch (Leaf 1) (Leaf 2))` should return `2`.
237252

238253
> treeSize :: Tree a -> Int
@@ -262,7 +277,7 @@ should return `(IBranch 1 (IBranch 2 ILeaf ILeaf) ILeaf)`.
262277

263278
> takeTreeWhile :: (a -> Bool) -> InternalTree a -> InternalTree a
264279
> takeTreeWhile = error "Define me!"
265-
280+
266281
Write the function map in terms of foldr:
267282

268283
> myMap :: (a -> b) -> [a] -> [b]
@@ -324,7 +339,7 @@ this one value for purposes of this assignment. The XML value in
324339
information as `Play.hs`. You may want to have a look at it in your
325340
favorite browser. The HTML in `sample.html` has the following structure
326341
(with whitespace added for readability):
327-
342+
328343
~~~
329344
<html>
330345
<body>
@@ -370,13 +385,13 @@ to `sample.html`.
370385
>
371386
> firstDiff :: Eq a => [a] -> [a] -> Maybe ([a],[a])
372387
> firstDiff [] [] = Nothing
373-
> firstDiff (c:cs) (d:ds)
374-
> | c==d = firstDiff cs ds
388+
> firstDiff (c:cs) (d:ds)
389+
> | c==d = firstDiff cs ds
375390
> | otherwise = Just (c:cs, d:ds)
376391
> firstDiff cs ds = Just (cs,ds)
377-
>
392+
>
378393
> testResults :: String -> String -> IO ()
379-
> testResults file1 file2 = do
394+
> testResults file1 file2 = do
380395
> f1 <- readFile file1
381396
> f2 <- readFile file2
382397
> case firstDiff f1 f2 of
@@ -420,10 +435,11 @@ Submission Instructions
420435

421436
* If working with a partner, you should both submit your assignments
422437
individually.
423-
* Make sure your `hw1.lhs` is accepted by GHC without errors or warnings.
438+
439+
* Make sure your `Hw1.hs` is accepted by GHCi without errors or warnings.
440+
424441
* Attach your `hw1.hs` file in an email to `[email protected]` with the
425-
subject "HW1" (minus the quotes).
426-
*This address is unmonitored!*
442+
subject "HW1" (minus the quotes). *This address is unmonitored!*
427443

428444
Credits
429445
-------

0 commit comments

Comments
 (0)