Changes to code based on customer inquiries#5
Open
transducer wants to merge 3 commits intoPacktWorkshops:masterfrom
Open
Changes to code based on customer inquiries#5transducer wants to merge 3 commits intoPacktWorkshops:masterfrom
transducer wants to merge 3 commits intoPacktWorkshops:masterfrom
Conversation
Since (apply min <any-coll> 0) is always 0
There's a bug in the code for direct routes that are not over multiple hops.
min-route expects a collection so we should always return a collection.
This way it works for both direct and indirect routes:
(find-path (grouped-routes routes) :paris :london)
;; => {:cost 236, :best [:paris :london]}
(find-path (grouped-routes routes) :paris :budapest)
;; => {:cost 251, :best [:paris :milan :vienna :budapest]}
allentiak
suggested changes
Apr 15, 2023
| (->> users | ||
| (filter #(= (:status %) status)) | ||
| (map field) | ||
| (apply min))) ;; do not use a default, (min '()) returns nil |
There was a problem hiding this comment.
Maybe this might work better?
(apply (fnil min 0)))
Contributor
Author
There was a problem hiding this comment.
@allentiak doesn't work since min takes variable amount of arguments
Contributor
Author
There was a problem hiding this comment.
Note that how the code was before, for the values of the game-users it will always return a min of 0
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear maintainer,
Based on inquiries I changed some code. I think it's now more correct. Let me know if there are any questions.
Kind regards,
Erwin
Activity 4.01:
Align and do not use default with
apply minSince
(apply min <any-coll> 0)is always 0Exercise 6.07:
There's a bug in the code for direct routes that are not over multiple hops.
min-route expects a collection so we should always return a collection.
This way it works for both direct and indirect routes: