Symbols Are Symbols

Code is just another language

In which I consider farm life

I have a plan. A very short term one, but a potentially very important and fulfilling one. If I do get into Hack Reactor, there will be at least a month-long gap (and more likely 3-6 months since I dragged my feet scheduling my second interview, and classes fill up fast) between now and when I actually begin classes above the pawn shop on Market Street. [There also used to be a mental health counseling and advocacy center on the floor below, but they moved out.] I hope to fill it with a stint at a farm on I’ve actually always wanted to live on a farm and learn about animal husbandry (and I’ll admit that spending time near livestock, herding dogs, and rural landscapes is deeply appealing). Food and lodging are free on workaways, and you can negotiate your hours and responsibilities, so I figure I can kill two birds with one stone while I take care of my HR prep-work. I love the idea of physical tasks by day and mental tasks by night. I love the idea of seeing stars and grass everyday after 3 years of their near total absence in Beijing. I want to experience actual exhaustion and hard work. Enforced, elegant simplicity.


I like simplicity, and this has helped me understand anonymous functions better recently. They make a lot of sense when you only intend to use a function once, especially when you intend to use it as a callback function. Why would you go to the trouble of coming up with and then remembering a name of a function that you are going to treat like a disposable plate? It makes no sense–especially when you are more of a words person and agonize over what to name each function. 

Here’s a short example of what I mean. Below is the long way to do it, without utilizing an anonymous function:

var wastefulFunction = function (x,y) {
console.log(“Like so many farts in the wind.”);

setInterval(wastefulFunction, 3000);
Above, I made a function just so that I could use it with setInterval. But let’s assume I didn’t use wastefulFunction anywhere else in my code. It would be better to just create an anonymous function directly inside of setInterval do this:
setInterval(function (x,y) {console.log(“Like so many farts in the wind.”)}, 5000);
The functionality is the same, but it’s shorter and uses up less memory on my part (if not the computer’s).


Yes, you actually have to practice

I once took a “total immersion” Farsi class in college. Our textbook was written what seemed to me to be backwards, with each chapter starting off with full texts in Farsi, then a little vocab (not enough to read the texts), and only a few scant grammar lessons in the back. We were supposed to just “figure it out” and learn by practicing. I am used to poring over robust explanations of grammar and syntax before I try to read in a new language, let alone try to form a sentence on my own. I need to know where a language is going before I start to see patterns. Needless to say, I found that class to be an exercise in futility and did not enroll in a second semester.
But while that textbook was a little extreme for my taste, I know that I have a tendency to to swing to the other extreme and get caught up with theory and neglect doing drills with practical examples. It took me a surprisingly long time (maybe year 3 of learning Chinese?) to realize that I had this habit, and it took me even longer to train myself to study more effectively. Theory is great. Memorization is awesome. But it all leaks out of your brain like water through a sieve if you don’t actually practice. Apparently this is intuitive for most people.
So anyway, this is an extremely long-winded way of explaining why I now do Coderbyte or other similar code exercises every day. I’m still shaky on fundamentals, and the dumb mistakes I make kind of amaze me. Obviously I make far fewer of them when I actually practice the easy stuff. I’m looking forward to eventually getting to the day when either all of this stuff is automatic or I am writing complex enough code on real projects that I actually have to incorporate many different methods and get practice that way.
In this particular problem, where the objective is to capitalize the first letter of each word, I forgot two important things that made the solution unnecessarily difficult:
function LetterCapitalize(str) {
  str = str.split(” “);
  for (var i = 0; i <str.length; i++) {
    str[i] = str[i].split(“”);
    str[i][0] = str[i][0].toUpperCase();
    str[i] = str[i].join(“”);
  str = str.join(” “);
  return str;
The first was that I couldn’t figure out how to make the changes I was making (str[i][0].toUpperCase()) during each iteration of the loop permanent. Make a second array and use push? Create more loops? More variables? I have no idea why at first I didn’t remember to just set str[i][0] equal to the desired value.
The second ridiculous problem I had was figuring out how to iterate over the individual letters in str[i]. I was really hung up on the idea of using a second for loop, and I couldn’t figure out why that wasn’t working. I forgot that str[i] was a string, not an array, and you can’t iterate over a string with a for loop. [ I also realized that no iteration was necessary anyway because I could use charAt or just position 0].