-
Notifications
You must be signed in to change notification settings - Fork 105
add answers to exercise 1-5 chapter 7 #30
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
add answers to exercise 1-5 chapter 7 #30
Conversation
def second_=(x: Q)(implicit txn: InTxn) = rSecond.single.transform(old => x) | ||
|
||
def swap()(implicit e: P =:= Q, txn: InTxn): Unit = { | ||
val old = Ref[P](first) |
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.
It shouldn't be necessary to create a Ref
object just to hold the value of the first field.
It is sufficient to read it via apply
(i.e. just call first
) and store the value of type P
directly to the local variable.
val old = first
Thanks, looking good overall! I only left some minor comments for exercise 1. |
@axel22 |
use the apply method of e to convert directly P => Q
Hi @axel22, I use |
Unfortunately, not that I know of. Ideally, LGTM |
Thanks for your contribution! |
Thanks for the review |
Hi @axel22,
Pls see this answers