Skip to content

Commit 0deb7e7

Browse files
committed
Update all docs to conform to style guide.
1 parent d3ab1d3 commit 0deb7e7

File tree

4 files changed

+40
-70
lines changed

4 files changed

+40
-70
lines changed

exercises/concept/pizza-pi/.docs/approaches.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## A More Idiomatic Approach
44

5-
While this exercise encouraged the use of `=` in solving the final task (in order to introduce the comparison operators), the standard provides a number of predicates that can replace the expression you wrote with `mod` and `=`. The equation from the final task might be more idiomatically written as:
5+
While this exercise encouraged the use of `=` in solving the final task (in order to introduce the comparison operators), the standard provides a number of predicates that can replace the expression you wrote with `mod` and `=`.
6+
The equation from the final task might be more idiomatically written as:
67

78
```lisp
89
(zerop (mod (* pizzas 8) friends))

exercises/concept/pizza-pi/.docs/hints.md

+9-15
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22

33
## General
44

5-
- It might be useful to have a list of all of the numeric operations in Lisp
6-
you can find a [full list here](http://l1sp.org/cl/12.1.1)
5+
- It might be useful to have a list of all of the numeric operations in Lisp.
6+
you can find a [full list here](http://l1sp.org/cl/12.1.1)
77

88
## 1. A Dough Ratio
99

10-
- Common Lisp has [a built-in constant](http://l1sp.org/cl/pi) for π (pi)
10+
- Common Lisp has [a built-in constant](http://l1sp.org/cl/pi) for π (pi)
1111
- When it comes to rounding, the CL spec provides [a smattering of
1212
functions](http://l1sp.org/cl/floor)
1313

1414
## 2. A Splash of Sauce
1515

16-
- There is [a built-in operator](http://l1sp.org/cl/sqrt) that might help you
17-
take the square-root of a number
16+
- There is [a built-in operator](http://l1sp.org/cl/sqrt) that might help you take the square-root of a number
1817

1918
## 3. Some Cheese, Please
2019

21-
- For squaring or cubing numbers, there is a [built-in exponentiation
22-
function](http://l1sp.org/cl/expt)
23-
- You might want to take a look at [this page of rounding
24-
operations](http://l1sp.org/cl/floor) and check out some of the alternatives
25-
to `round`.
20+
- For squaring or cubing numbers, there is a [built-in exponentiation function](http://l1sp.org/cl/expt)
21+
- You might want to take a look at [this page of rounding operations](http://l1sp.org/cl/floor) and check out some of the alternatives to `round`.
2622

2723
## 4. A Fair Share
2824

29-
- This part requires using a function you may not have come across before, the
30-
[modulo function](https://en.wikipedia.org/wiki/Modulo_operation) (`mod`). This
31-
function gives you the remainder of the division between two numbers.
32-
- For comparing the result of `mod` to another number, [this page of comparison
33-
operators](http://l1sp.org/cl/=).
25+
- This part requires using a function you may not have come across before, the [modulo
26+
function](https://en.wikipedia.org/wiki/Modulo_operation) (`mod`). This function gives you the remainder of the division between two numbers.
27+
- For comparing the result of `mod` to another number, [this page of comparison operators](http://l1sp.org/cl/=).

exercises/concept/pizza-pi/.docs/instructions.md

+24-39
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,64 @@
11
# Instructions
22

3-
Lilly, a culinarily-inclined Lisp Alien, wants to throw a pizza party for
4-
themselves and some friends but, wanting to make the most of their ingredients, would
5-
like to know exactly how much of each component they'll need before starting.
3+
Lilly, a culinarily-inclined Lisp Alien, wants to throw a pizza party for themselves and some friends but, wanting to make the most of their ingredients, would like to know exactly how much of each component they'll need before starting.
64

7-
To solve this problem, Lilly has drafted a program to automate some of the
8-
planning but needs your help finishing it. Will you help Lilly throw the
9-
proportionally perfect pizza party?
5+
To solve this problem, Lilly has drafted a program to automate some of the planning but needs your help finishing it.
6+
Will you help Lilly throw the proportionally perfect pizza party?
107

118
## 1. A Dough Ratio
129

13-
First things first, every great pizza starts with a delicious dough! Lilly is a
14-
fan of thin, crispy pizzas with a thicker crust, so the amount of dough needed
15-
for the middle of the pizza remains relatively constant (200g) but the amount
16-
needed for the crust increases as the pizza's size does. Every 20cm of crust
17-
requires 45g of dough.
10+
First things first, every great pizza starts with a delicious dough!
11+
Lilly is a fan of thin, crispy pizzas with a thicker crust, so the amount of dough needed for the middle of the pizza remains relatively constant (200g) but the amount needed for the crust increases as the pizza's size does.
12+
Every 20cm of crust requires 45g of dough.
1813

19-
Lilly is looking to write a function that takes the number of pizzas to make and
20-
their diameters then returns the exact amount of dough (to the nearest gram)
21-
that they'll need. For example, to make 4 pizzas 30cm in diameter:
14+
Lilly is looking to write a function that takes the number of pizzas to make and their diameters then returns the exact amount of dough (to the nearest gram) that they'll need.
15+
For example, to make 4 pizzas 30cm in diameter:
2216

2317
```lisp
2418
(dough-calculator 4 30) ; => 1648
2519
```
2620

27-
Helpfully, Lilly has worked out the following equation for calculating grams of
28-
dough (g) from the number of pizzas (n) and their diameters (d):
21+
Helpfully, Lilly has worked out the following equation for calculating grams of dough (g) from the number of pizzas (n) and their diameters (d):
2922

3023
$$g = n \cdot \left(\dfrac{45 \pi d}{20} + 200\right)$$
3124

3225
## 2. A Splash of Sauce
3326

34-
Lilly is astonishingly meticulous when it comes to their sauce application and
35-
always applies exactly 3ml of sauce to every 10 square centimeters of
36-
pizza. Ironically, the size of their pizzas can be incredibly inconsistent. Lilly
37-
needs your help defining a function that calculates the pizza size (the
38-
diameter) from the amount of sauce applied. For example, given Lilly has used
39-
250ml of sauce:
27+
Lilly is astonishingly meticulous when it comes to their sauce application and always applies exactly 3ml of sauce to every 10 square centimeters of pizza.
28+
Ironically, the size of their pizzas can be incredibly inconsistent.
29+
Lilly needs your help defining a function that calculates the pizza size (the diameter) from the amount of sauce applied.
30+
For example, given Lilly has used 250ml of sauce:
4031

4132
```lisp
4233
(size-from-sauce 250) ; => 32.57
4334
```
4435

45-
For this task, Lilly has prepped the following equation relating milliliters of
46-
sauce applied (s) to the pizza diameter (d):
36+
For this task, Lilly has prepped the following equation relating milliliters of sauce applied (s) to the pizza diameter (d):
4737

4838
$$d = \sqrt{\dfrac{40s}{3\pi}}$$
4939

5040
## 3. Some Cheese, Please
5141

52-
On Lilly's planet, all cheese comes in perfect cubes and is sold by size. (What
53-
were you expecting? This is an alien planet after all...) Your task is to help
54-
Lilly calculate how many pizzas they can make using any given cheese
55-
cube. Mozzarella cheese has a density of 0.5 grams per cubic centimeter and
56-
every pizza needs 3 grams of cheese per square centimeter. Given the side-length
57-
of some cheese cube and the pizzas' diameter, calculate the number of pizzas
58-
that can be made (always rounded down). For example, given a 25x25x25cm cheese
59-
cube and pizzas 30cm in diameter:
42+
On Lilly's planet, all cheese comes in perfect cubes and is sold by size.
43+
(What were you expecting? This is an alien planet after all...)
44+
Your task is to help Lilly calculate how many pizzas they can make using any given cheese cube.
45+
Mozzarella cheese has a density of 0.5 grams per cubic centimeter and every pizza needs 3 grams of cheese per square centimeter.
46+
Given the side-length of some cheese cube and the pizzas' diameter, calculate the number of pizzas that can be made (always rounded down).
47+
For example, given a 25x25x25cm cheese cube and pizzas 30cm in diameter:
6048

6149
```lisp
6250
(pizzas-per-cube 25 30) ; => 3
6351
```
6452

65-
Once again, Lilly has come to the rescue with an equation calculating the number
66-
of pizzas (n) of some diameter (d) that can be made from a cheese cube of a
67-
side-length (l):
53+
Once again, Lilly has come to the rescue with an equation calculating the number of pizzas (n) of some diameter (d) that can be made from a cheese cube of a side-length (l):
6854

6955
$$n = \dfrac{2l^3}{3 \pi d^2}$$
7056

7157
## 4. A Fair Share
7258

73-
Finally, Lilly wants to be sure that their pizzas (each made up of 8 slices) can
74-
be evenly divided between their friends. Your task is to define a function
75-
that takes a number of pizzas and number of friends then returns `T` if the
76-
pizza can be evenly divided between friends and `NIL` otherwise. For example:
59+
Finally, Lilly wants to be sure that their pizzas (each made up of 8 slices) can be evenly divided between their friends.
60+
Your task is to define a function that takes a number of pizzas and number of friends then returns `T` if the pizza can be evenly divided between friends and `NIL` otherwise.
61+
For example:
7762

7863
```lisp
7964
;; For splitting 3 pizzas between 4 friends

exercises/concept/pizza-pi/.docs/introduction.md

+5-15
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@ In Common Lisp, like many languages, numbers come in a few of types – two of t
44

55
## Integers
66

7-
Like many languages Common Lisp contains integers. These are whole numbers without a decimal point (like `-6`, `0`, `25`, `1234`,
8-
etc.)
7+
Like many languages Common Lisp contains integers. These are whole numbers without a decimal point (like `-6`, `0`, `25`, `1234`, etc.)
98

109
Common Lisp defines no limits on the magnitude of integers. Integers can be arbitrarily large (or small if negative).
1110

12-
In general, if you are working with only whole numbers, you should prefer
13-
integers as they don't suffer from the same loss of precision as floating-point
14-
numbers do over many calculations.
11+
In general, if you are working with only whole numbers, you should prefer integers as they don't suffer from the same loss of precision as floating-point numbers do over many calculations.
1512

1613
## Floating Point Numbers
1714

1815
Also like many languages, Common Lisp contains floating point numbers. These are fractional or whole numbers including a decimal point (like `3.14`, `-1.7`, `99.99`, `2048.0`)
1916

2017
## Arithmetic
2118

22-
Common Lisp uses the standard arithmetic operators for most operations but is
23-
somewhat unique in using a "prefix-notation" as opposed to the more familiar
24-
"infix-notion". More visually:
19+
Common Lisp uses the standard arithmetic operators for most operations but is somewhat unique in using a "prefix-notation" as opposed to the more familiar "infix-notion". More visually:
2520

2621
```lisp
2722
;; Infix-notation (non-lisp languages)
@@ -30,13 +25,8 @@ somewhat unique in using a "prefix-notation" as opposed to the more familiar
3025
(+ 1 2 3 4 5) ; => 15
3126
```
3227

33-
While prefix notion turns some operations like `2 + 2` into the somewhat
34-
unfamiliar `(+ 2 2)` form, it makes it much easier to operate on more than one
35-
number at a time.
28+
While prefix notion turns some operations like `2 + 2` into the somewhat unfamiliar `(+ 2 2)` form, it makes it much easier to operate on more than one number at a time.
3629

3730
## Comparing Numbers
3831

39-
Finally, you may find it useful to compare different numbers using functions
40-
like `=` (equal), `/=` (not equal to), and `>=` (greater than or equal to). When
41-
these comparisons are true (as in `(= 1 1)`), they return `T` and when they
42-
aren't (as in `(> 0 1)`), they return `NIL`.
32+
Finally, you may find it useful to compare different numbers using functions like `=` (equal), `/=` (not equal to), and `>=` (greater than or equal to). When these comparisons are true (as in `(= 1 1)`), they return `T` and when they aren't (as in `(> 0 1)`), they return `NIL`.

0 commit comments

Comments
 (0)