Skip to content

Commit 1756d7f

Browse files
authored
Merge pull request #168 from cmsc430/ziggy
Ziggy
2 parents 68dc141 + b6e5074 commit 1756d7f

8 files changed

Lines changed: 238 additions & 90 deletions

File tree

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
pages: write
4141
id-token: write
4242
environment:
43-
name: github-pages
43+
name: www
4444
url: ${{ steps.deployment.outputs.page_url }}
4545
runs-on: ubuntu-latest
4646
if: github.ref == 'refs/heads/main'

langs/intro/bt.rkt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,36 @@
55
(require rackunit))
66

77
;; type Bt =
8-
;; | `leaf
9-
;; | `(node ,Integer ,Bt ,Bt)
8+
;; | (leaf)
9+
;; | (node Integer Bt Bt)
10+
(struct leaf () #:prefab)
11+
(struct node (v l r) #:prefab)
1012

1113
;; Bt -> Boolean
1214
;; Is the binary tree empty?
1315
(define (bt-empty? bt)
1416
(match bt
15-
['leaf #t]
16-
[(cons 'node _) #f]))
17+
[(leaf) #t]
18+
[_ #f]))
1719

1820
(module+ test
19-
(check-equal? (bt-empty? 'leaf) #t)
20-
(check-equal? (bt-empty? '(node 3
21-
(node 7 leaf leaf)
22-
(node 9 leaf leaf)))
21+
(check-equal? (bt-empty? (leaf)) #t)
22+
(check-equal? (bt-empty? (node 3
23+
(node 7 (leaf) (leaf))
24+
(node 9 (leaf) (leaf))))
2325
#f))
2426

2527
;; Bt -> Natural
2628
;; Compute the height of a binary tree
2729
(define (bt-height bt)
2830
(match bt
29-
[`leaf 0]
30-
[`(node ,_ ,left ,right)
31+
[(leaf) 0]
32+
[(node _ left right)
3133
(+ 1 (max (bt-height left)
3234
(bt-height right)))]))
3335

3436
(module+ test
35-
(check-equal? (bt-height 'leaf) 0)
36-
(check-equal? (bt-height '(node 3 leaf leaf)) 1)
37-
(check-equal? (bt-height '(node 2 leaf (node 1 leaf leaf)))
37+
(check-equal? (bt-height (leaf)) 0)
38+
(check-equal? (bt-height (node 3 (leaf) (leaf))) 1)
39+
(check-equal? (bt-height (node 2 (leaf) (node 1 (leaf) (leaf))))
3840
2))

www/assignments.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@local-table-of-contents[#:style 'immediate-only]
55

66
@include-section{assignments/1.scrbl}
7-
@;include-section{assignments/2.scrbl}
7+
@include-section{assignments/2.scrbl}
88
@;include-section{assignments/3.scrbl}
99
@;include-section{assignments/4.scrbl}
1010
@;include-section{assignments/5.scrbl}

www/assignments/1.scrbl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ the name or signature of any function given to you. You may add any
2626
additional functions that help you solve the overall problem you're
2727
tackling.
2828

29-
@section[#:tag-prefix "a2-" #:style 'unnumbered]{Testing}
29+
@section[#:tag-prefix "a1-" #:style 'unnumbered]{Testing}
3030

3131
You can test your code in several ways:
3232

@@ -45,13 +45,13 @@ You can test your code in several ways:
4545
Note: running @tt{racket <filename.rkt>} will @bold{not} test the
4646
file; you need to use @tt{raco} or DrRacket.
4747

48-
@section[#:tag-prefix "a2-" #:style 'unnumbered]{Submitting}
48+
@section[#:tag-prefix "a1-" #:style 'unnumbered]{Submitting}
4949

5050
Use the included Makefile to run @tt{make submit.zip} (or simply
5151
@tt{make}) to generate an appropriate @tt{submit.zip} file for
5252
submitting to Gradescope.
5353

54-
@section[#:tag-prefix "a2-" #:style 'unnumbered]{Grading}
54+
@section[#:tag-prefix "a1-" #:style 'unnumbered]{Grading}
5555

5656
Your submission will be graded for correctness. Passing the unit
5757
tests included in the file is necessary but @bold{not sufficient} to

www/assignments/2.scrbl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
#lang scribble/manual
2-
@title[#:tag "Assignment 2" #:style 'unnumbered]{Assignment 2: Racket Primer}
2+
@title[#:tag "Assignment 2" #:style 'unnumbered]{Assignment 2: a86 Primer}
33

4-
@bold{Due: Wednesday, September 13, 11:59PM}
4+
@bold{Due: Wednesday, February 14, 11:59PM}
55

6-
The goal of this assignment is to gain practice programming in Racket.
6+
The goal of this assignment is to gain practice programming in a86.
77

88
@bold{This is a collaborative assignment.} You may work with anyone
99
you'd like on this assignment, but each person must submit their
10-
@tt{main.rkt} file on Gradescope.
11-
12-
You are given a @tt{main.rkt} file (on ELMS under "Files"), that
13-
contains a number of sections. In each section there are several
14-
function ``stubs,'' i.e. incomplete function definitions with type
15-
signatures, descriptions, and a small set of tests. Each function has
16-
a bogus (but type correct) body marked with a ``TODO'' comment. Your
17-
job is to replace each of these expressions with a correct
18-
implementation of the function.
19-
20-
The last section of problems deals with functions that operate over a
21-
representation of expressions in a lambda-calculus-like language and
22-
asks you to compute a few simple facts about the given expression.
23-
24-
Make sure you do not rename the file. Also make sure not to change
25-
the name or signature of any function given to you. You may add any
10+
@tt{submit.zip} file on Gradescope.
11+
12+
You are given a @tt{a86-basics.zip} file (on ELMS under "Files"), that
13+
contains a README, a Makefile, and a number of Racket modules. In
14+
each module there are several ``stubs,'' i.e. incomplete definitions
15+
with type signatures, descriptions, and a small set of tests. Each
16+
definition has a bogus (but type correct) body marked with a ``TODO''
17+
comment. Your job is to replace each of these expressions with a
18+
correct implementation of the a86 code.
19+
20+
Make sure you do not rename any files. Also make sure not to change
21+
the name or signature of any definition given to you. You may add any
2622
additional functions that help you solve the overall problem you're
2723
tackling.
2824

@@ -37,15 +33,19 @@ You can test your code in several ways:
3733
This is actually a configurable preference, but it is on by
3834
default.}
3935

40-
@item{Using the command line @tt{raco test main.rkt} from
41-
the same directory as @tt{main.rkt}.}]
36+
@item{Using the command line @tt{raco test <filename.rkt>} from
37+
the same directory as your Racket code will test the module
38+
in @tt{<filename.rkt>}. If you run @tt{raco test .}, it will
39+
test all of the Racket files in the current directory.}]
4240

43-
Note that running @tt{racket main.rkt} from the command line will
44-
@bold{not} run the tests.
41+
Note: running @tt{racket <filename.rkt>} will @bold{not} test the
42+
file; you need to use @tt{raco} or DrRacket.
4543

4644
@section[#:tag-prefix "a2-" #:style 'unnumbered]{Submitting}
4745

48-
Submit your filled-in @tt{main.rkt} file on Gradescope.
46+
Use the included Makefile to run @tt{make submit.zip} (or simply
47+
@tt{make}) to generate an appropriate @tt{submit.zip} file for
48+
submitting to Gradescope.
4949

5050
@section[#:tag-prefix "a2-" #:style 'unnumbered]{Grading}
5151

0 commit comments

Comments
 (0)