Sunday, 22 February 2015

Trees! Trees!

We learned about the concept of trees in the past week.  The theory behind it is that we access a main data centre point and then from this point we gain access to more data stored in its children.  This simple concept of data organization allows for the storing of complex data in an organized way which  enables humans to do very practical things with it, or so I would imagine, given that I have seen it in practice, but the profoundness of it is clear.  Writing code for the practice questions and the labs I found were tricky, because I needed to take into consideration trees within trees within trees, but i definitely loved the challenge.

Sunday, 8 February 2015

On Recursions

This past week we have been doing recursion exercises.  I have to admit, they have been pretty fun, tracing the the function call in your head to figure out what will be produced.  The clever thing about the recursions is that many of the recursive functions have itself as code in the function body.  For example, def  o(g):
                       ........
                       return sum(x in o(f))

A very clever implementation indeed.  I love that it is easy to look at and it is efficient.  The practice of tracing is not hard either, since if the function does what it proposes to do, then the produce should be what is expected so there is nothing challenging.