Archive

Monthly Archives: June 2016

Intro

Most of my articles have targeted software development. However, in this article (which may be my last), I have decided to write about something that I usually don’t disclose even to those I’m closest to.

My Way Out

I used software development as a way out of the life that I came from. I didn’t really understand what it meant to code. But I did know that there were high-paying jobs if I brute forced my way to understanding it. So I took out government loans for school and harassed professors at the end of lectures. After a decade of nonstop bombardment, coding finally clicked for me. Some people even believed I was smart. I felt good about myself and my accomplishments. Thus, I continued doing what had proven to work for me. After a while though, I became addicted. Coding not only provided an escape route from my previous lifestyle, but it also became my escape route from reality itself.

I’m no different than a drug addict or a drunkard when it comes to masking pain. Instead of consuming drugs or alcohol though, I’m producing code. So why am I just as guilty? Because, instead of confronting my personal problems head-on, and with a mature manner, I have repeatedly chosen to shelve my problems aside and instead, focus on my career.

“Problems get worse; not better when ignored”

One of my mentors, would consistently utter that phrase to me whenever he’d learn that I was postponing a serious responsibility. Whether it was my physical health, or my personal relationships, he attempted to instill in me that problems only get worse (and not better) when not tackling them head-on.

In my case, instead of seeking professional help to pacify my issues with love ones and physical health, I’d repeatedly use work as my only channel, thus distracting me from my own harsh realities. Although I have reached levels that I’d thought I’d never achieve, I’ve also accrued massive amounts of emotional and spiritual debt. Just like drugs, I would try my hardest to mask my problems by just going to work. My wife would complain when I would abruptly jump out of bed at two o’clock in the morning to go to work. She would skype me hours later just to see my face in a dark lit cubicle where the only source of light is that of my dual monitors which reflects the latest code that I’d just wrote. She didn’t understand why and how I could do this to myself for several days at a time. In retaliation, I would often get angry and tell her that the behavior that she’s complaining about is the exact same behavior that got us living by the beach and having what we have. Instead of seeking counseling to avoid deeper problems, I chose to isolate myself and pursue money instead.

Conclusion

In conclusion, after several years of going full-throttle in my career, I’m now burnt-out. Thus, I now spend a significant amount of time reflecting on my life and those that I have hurt. The result of my reflection strongly suggests that I have been a coward when confronted by my greatest enemies. Hence, I consistently hid behind a keyboard and terminal instead of confronting my personal issues head-on. Thus, making me a coward.

Advertisements

Intro

Partial Application enables functional programmers the ability to write a consolidated expression such that they can run elements of a collection into a function that requires not just the element but other arguments as well.

Function Signatures

I have struggled with the Partial Application concept. Specifically, I just did not understand the context where it could be useful. I then stumbled upon the F# Gazette. In the artcle, Scott Wlaschin addressed my confusion. In short, I learned that Partial Application can be especially useful when applying elements of a collection to a function.

For example, let’s take the following function:

let isDivisible divisor input = input % divisor = 0

The function above is a typical function that could be deemed useful when crunching numbers.

Now what if we wanted to take a list of numbers and filter out only the numbers that are divisible by two?

Well, in F# we could do this:

let isDivisibleBy2 = isDivisible 2

The expression above represents a partial application. Specifically, we provide a function one or more of the arguments that we’re going to use. So in this example, we happen to declare a new function that references another function with some of the inputs already provided.

In order for this to work, the compiler takes our initial function signature:

let isDivisible divisor input = input % divisor = 0

and rewrites it as the following function signature:

let isDivisible divisor = fun input -> input % divisor = 0

The rewritten function signature above says the following:
IsDivisible will now return a value that takes the form of a function that will require its own argument (i.e. input) in addition to the argument that it required initially (i.e. divisor).

So we can take the compiler’s rewritten function signature:

let isDivisible divisor = fun input -> input % divisor = 0

And thus declare a new function that uses the rewritten function signature like this:

let isDivisibleBy2 = isDivisible 2

The function isDivisibleBy2 will now return a function that requires just one argument for the value that we want to divide 2 by.

We can now take advantage of the Partial Application feature by applying a partially applied function to a list of values:

List.filter isDivisibleBy2 [1..10]

Conclusion

In conclusion, Partial Application enables functional programmers the ability to write a consolidated expression such that they can run elements of a collection into a function that requires not just the element but other arguments as well.