-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to code based on customer inquiries #5
base: master
Are you sure you want to change the base?
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]}
(->> users | ||
(filter #(= (:status %) status)) | ||
(map field) | ||
(apply min))) ;; do not use a default, (min '()) returns nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this might work better?
(apply (fnil min 0)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allentiak doesn't work since min
takes variable amount of arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that how the code was before, for the values of the game-users
it will always return a min of 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the answer!
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 min
Since
(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: