-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,966 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
(datatype binary | ||
|
||
if (element? X [0 1]) | ||
_____________ | ||
X : zero-or-one; | ||
if (element? X [0 1]) | ||
_____________ | ||
X : zero-or-one; | ||
|
||
X : zero-or-one; | ||
________________ | ||
[X] : binary; | ||
X : zero-or-one; | ||
________________ | ||
[X] : binary; | ||
|
||
X : zero-or-one; Y : binary; | ||
____________________________ | ||
[X | Y] : binary; | ||
X : zero-or-one; Y : binary; | ||
____________________________ | ||
[X | Y] : binary; | ||
|
||
X : zero-or-one, [Y | Z] : binary >> P; | ||
________________________________________ | ||
[X Y | Z] : binary >> P;) | ||
X : zero-or-one, [Y | Z] : binary >> P; | ||
________________________________________ | ||
[X Y | Z] : binary >> P;) | ||
|
||
(define complement | ||
{binary --> binary} | ||
[0] -> [1] | ||
[1] -> [0] | ||
[1 N | X] -> [0 | (complement [N | X])] | ||
[0 N | X] -> [1 | (complement [N | X])]) | ||
{binary --> binary} | ||
[0] -> [1] | ||
[1] -> [0] | ||
[1 N | X] -> [0 | (complement [N | X])] | ||
[0 N | X] -> [1 | (complement [N | X])]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,17 @@ | |
[X] -> [X] | ||
[X Y | Z] -> [Y | (bubble [X | Z])] where (> Y X) | ||
[X Y | Z] -> [X | (bubble [Y | Z])]) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
(define cartesian-product | ||
[] _ -> [] | ||
[X | Y] Z -> (append (all-pairs-using-X X Z) (cartesian-product Y Z))) | ||
[ ] _ -> [ ] | ||
[X | Y] Z -> (append (all-pairs-using-X X Z) (cartesian-product Y Z))) | ||
|
||
(define all-pairs-using-X | ||
_ [] -> [] | ||
X [Y | Z] -> [[X Y] | (all-pairs-using-X X Z)]) | ||
_ [ ] -> [ ] | ||
X [Y | Z] -> [[X Y] | (all-pairs-using-X X Z)]) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
(define count-change | ||
Amount -> (count-change* Amount 200)) | ||
Amount -> (count-change* Amount 200)) | ||
|
||
(define count-change* | ||
0 _ -> 1 | ||
_ 0 -> 0 | ||
Amount _ -> 0 where (> 0 Amount) | ||
Amount Fst_Denom | ||
-> (+ (count-change* (- Amount Fst_Denom) Fst_Denom) | ||
(count-change* Amount (next-denom Fst_Denom)))) | ||
0 _ -> 1 | ||
_ 0 -> 0 | ||
Amount _ -> 0 where (> 0 Amount) | ||
Amount Fst_Denom | ||
-> (+ (count-change* (- Amount Fst_Denom) Fst_Denom) | ||
(count-change* Amount (next-denom Fst_Denom)))) | ||
|
||
(define next-denom | ||
200 -> 100 | ||
100 -> 50 | ||
50 -> 20 | ||
20 -> 10 | ||
10 -> 5 | ||
5 -> 2 | ||
2 -> 1 | ||
1 -> 0) | ||
200 -> 100 | ||
100 -> 50 | ||
50 -> 20 | ||
20 -> 10 | ||
10 -> 5 | ||
5 -> 2 | ||
2 -> 1 | ||
1 -> 0) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.