Skip to content

Commit d1326e4

Browse files
committed
Fix: trailing white space and missing EOL
1 parent 41becb8 commit d1326e4

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

exercises/practice/knapsack/.docs/instructions.append.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The items are represented by [records](https://lfe.gitbooks.io/reference-guide/content/16.html), defined in `item.lfe`.
2-
Use `item-weight` to get the weight and `item-value` to get the value.
2+
Use `item-weight` to get the weight and `item-value` to get the value.
33

44
```
55
;; Create an item with weight=5, value=50
@@ -10,4 +10,4 @@ Use `item-weight` to get the weight and `item-value` to get the value.
1010
1111
;; Get the value. Returns 50.
1212
(item-value item)
13-
```
13+
```

exercises/practice/knapsack/.meta/example.lfe

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
(weight-value (item-weight item))
1111
(value-value (item-value item))
1212
(left-over-capacity (- capacity weight-value)))
13-
(if
13+
(if
1414
(< left-over-capacity 0)
1515
value-without
16-
(let
16+
(let
1717
((value-with
1818
(+
1919
(lists:nth (+ left-over-capacity 1) last-values)
@@ -22,27 +22,27 @@
2222

2323
(defun next-values
2424
([item last-values -1 acc] acc)
25-
([item last-values capacity acc]
26-
(next-values
27-
item
28-
last-values
29-
(- capacity 1)
25+
([item last-values capacity acc]
26+
(next-values
27+
item
28+
last-values
29+
(- capacity 1)
3030
(cons (find-max item last-values capacity) acc))))
3131

3232
(defun do-maximum-values
3333
(['() last-values capacity] (lists:last last-values))
3434
([(cons item remaining) last-values capacity]
3535
(do-maximum-values
36-
remaining
36+
remaining
3737
(next-values item last-values capacity '())
3838
capacity)))
3939

4040
(defun maximum-value
4141
(('() _capacity) 0)
4242
((items capacity)
43-
(do-maximum-values
43+
(do-maximum-values
4444
items
45-
(lists:duplicate
45+
(lists:duplicate
4646
(+ capacity 1)
4747
0)
4848
capacity)))
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
; This include file defines the item record used in the exercise.
22
; There shouldn't be any need to modify this file.
33

4-
(defrecord item weight value)
4+
(defrecord item weight value)

exercises/practice/knapsack/test/knapsack-tests.lfe

-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,3 @@
8181
(make-item weight 118 value 229)
8282
(make-item weight 120 value 240))
8383
750)))
84-

0 commit comments

Comments
 (0)