Skip to content

Commit e7c0b94

Browse files
authored
Merge pull request #48 from CreatorJohn/patch-1
Fixing `cheaper?`
2 parents 0b94664 + dec15bc commit e7c0b94

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

exams/cheap-flights/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ partial solutions to extend the cheapest path.
7878
In Scheme you can `sort` a list with the help of a predicate function taking two arguments. In case
7979
of a list of lists (containing cost and path) you could do the following:
8080
```racket
81-
> (define (cheaper? x y) (< (car x) (car y)))
81+
> (define (cheaper? x y) (< (cadr x) (cadr y)))
8282
> (sort '(((2 3) 2.0) ((2 1 3) 1.5)) cheaper?)
8383
'(((2 1 3) 1.5) ((2 3) 2.0))
8484
```

0 commit comments

Comments
 (0)