#BlogElul Day 13: Remember

On day 6 when I wrote about “know”ing , I related a story about how the remembering part wasn’t important, it was knowing where to find the information, and knowing what to do with it once you had it.

I’m going to contradict myself now.

First, it’s fairly obvious that if you can’t remember WHERE to find the right information, you don’t really know it. But that’s just a nit-picky point on the semantics of “know” versus “remember” in a particular context.

What I want to suggest is that – if you look at it from another perspective – all of IT is the creation of systems that aid in the act of remembering.

One of the most elegent examples of this is a common first-year programming exercise: creating a script that uses a single variable to produce a fibonacci sequence.

A fibonacci sequence is a set of numbers where the NEXT number is the sum of the previous two. So it starts out 1 1 2 3 5 8 13 21 34 55 and so on.

The exercise to create a script which calculates as many iterations as the user desires using a single variable is challenging because somehow the script must remember:

  • The number of iterations requested
  • the current number
  • the previous number
  • …so that the NEXT number can be calculated.

One such example looks like this:

sub fibRec {
my $n = shift;
$n < 2 ? $n : fibRec($n - 1) + fibRec($n - 2);
}

What makes this script move beyond being merely functional and into that magical realm which programmers call “elegant” is the way it uses recusion (calling itself) and the shift command to maintain it’s coherence.

It is also a great lesson for us in life: With structure and a bit of creativity, we can eliminate all the dross, all the superfluous bits of our life because what we need to remember is tied up with what we are doing and what we need to do.