What doesn't seem to work well is getting authenticated to comment (using Twitter for example) without the comment being lost.
Also it seems that when using the link in the notification e-mail subsequent authentication after clicking comment doesn't bring you back to where you started. (At least not on Safari)
Very true about code readability. Scala is definitely one of the tools that can produce a lot of spaghetti code unless you use the language «the right way». Just curious, how often do you use implicits?
And I would submit to you that some of the «Scala Peculiarities» should be used rarely if at all.If you don't agree on a common, simple standard for scala code in your organization, you will accumulate a lot of technical debt.Code is read more often that it is written or changed.If reading it is a chore, you've failed.And in languages like scala it is very easy to write code that is hard to read.
You have a slight typo, should be «new DoBody» not «new DoDody»object Do{ def apply(body: => Unit) = new DoDody(body)} class DoBody(body: => Unit){ def until(cond: =>Unit): Unit = { body while(!cond) body }}
The case class example at the beginning does not generate setter methods, only getter methods. You would need to change the constructor parameters to vars to generate setter methods. By default, they're treated as vals.
Dear Hub,
Thanks for your kindly reply. I noticed that the implementation you suggested used push operation instead of recursive function. How do you think the efficiency of these two implementations?
Thanks,
Tang Laoya
You are fun. Seriously. Unfortunately, Nikolai Ershov is not around to comment on how to improve the code. But I think your code looks good. You can also check this implementation: AVLTree.h and AVLTree.cpp.
Dear Hub,
The problem is solved after modified the function popmax as follows:
void * popmax(avltree* &p)
{
avltree* max=findmax(p);
void *key=max->key;
p=remove(p,key);
return key;
}
Do you have any suggestion to improve the code for faster speed, especially the function popmax?
Thanks,
Tang Laoya
Dear Hub,
Sorry to bother you again. There are still some problems.
when the code running in the latter (after many times insert/remove/popmax operations, the code will crash.
The code is used as follows:
node *avlroot;
avlroot=insert(avlroot,(void*)t); /// happened at many locations
...
avl=popmax(avlroot); /// happened at many locations
...
avlroot=remove(avlroot,(void*)t); /// happened at many locations
...
/// finally
deletetree(avlroot);
Is there any problem in using the code?
Thanks,
Tang Laoya
Also it seems that when using the link in the notification e-mail subsequent authentication after clicking comment doesn't bring you back to where you started. (At least not on Safari)
It's yet another convenience (aka write less) taken too far.
Thanks for getting back to me.
I'd love to see similar articles about Groovy, Kotlin, Ceylon and Fantom! :)