Thursday, October 18, 2007

Streams for Incremental and Tail-Recoursive Computing

Programming in Scala is a lot of fun for me, but I really love Streams. Their laziness allows really nice implementations of incremental algorithms and tail-recursive functions. the best thing is they can be used efficiently under different requirements: no matter if you are interested in each intermediate result or only the final one, you'll only need one implementations. =)

I hope the following example computing the factorial(s) using Streams explains it well:

Wednesday, October 17, 2007

Building Scala from the Sources

As I noticed that the actual Scala sources include a great enhancement for all RandomAccessSeq.Mutables, such as Array or ArrayBuffer: Now, the methods drop, take, slice and reverse return a RandomAccessSeq.MutableProjection, which allows cool things to be done in O(1), e.g. Array(1,2,3) reverse(0) = 10.

Unable to hold mysself back waiting, I decided try the latest version. All I had to do was to follow these instruction: Building Scala 2 from the sources. Et viola, one can already taste some of the features/fixes scheduled for Scala 2.6.1. =)

Saturday, October 06, 2007

11 Amazingly Simple Tricks To Turn Your Brain Into A Powerful Thinking Machine

Today, I enjoyed reading the article 10 Amazingly Simple Tricks To Turn Your Brain Into A Powerful Thinking Machine. Actually, my life includes most of the them since quite a time, except for points 4 and 9. Ok and the first "trick" I only do partly, because I don't focus that much on varying the the subjects - but who's perfect. ;-)

However one important thing is left on the list, maybe because it is not so simple as the others:

0. Exercise every 1 or 2 days

It has been shown recently, that for adults the only way to create new brain cells is exercise. Especially these greatly improve learning and memory, if combined with the daily brain training like described in 1-10. The reason is that the new cells get instantly inserted into the neural network where needed, which is a faster process than optimizing by transforming/rebuilding it.
So this is really step zero, since without challenging the mind (brain training, learning), the new cells will not be linked strong enough and therefore will die within a few weeks.

Regularly sport and fitness exercises are great, but I believe not using the elevator for changing only 1-3 floors and going small distances by foot or bike are nice additions.


[1] First Proof that Exercise Creates New Cells in Brain Area Affecting Age-Related Memory Loss
[2] Das Wundermittel namens Bewegung - Hirnforscher revidieren alte Lehrmeinungen (german)