Functional programming (often abbreviated FP) is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. We will discuss some of these concepts and their benefits.

Purity

Purity means there are no side effects to a function. The only impact pure functions can have on the outside world is through their output value, and the only way the external world affect them is through their parameters.

This function is pure:

def addition(x, y):
return x + y

This function is impure:

def call_server():
return requests.get("google.com")

Pure functions are nice, because they are easy to reason…


A fix for corporates

Like many others I read Noam Bardin’s post and it resonated with me. Especially the part about employee motivations.

It is often I find myself talking about the similarities between programming and managing, so maybe programming is a way to start what I want to say.

One principle which good programmers adhere to is the following: a function should do one thing, and one thing alone.

This is a good practice because it helps you separate your program into very small steps, and small steps are easier to read, write, understand, test, optimize and reuse. Let’s illustrate the relationship between…


Sometimes simple questions lead you to an interesting trail of thoughts. This one was “should you use nested functions to encapsulate logic only used once?”

First of all, a small refresher, nested functions are functions written within a scope of another function. They have many uses in python.

def foo(a, b, c):    def bar(x, y):
return x * y

return bar(a, b) + c

But for this question, the asker was interested in the case where some logic which is used only within foo can be encapsulated within its scope.

When coding we want to hide immaterial detail. E.g. we…


Imperative programming is characterized by iterative nesting. A function has embedded calls to other ones. By embedded I mean that these calls are in the function body, and so there is a tight coupling between a function and its constituents. This has many shortcomings and is typically solved by function composition.

Composition is like taking two things and connecting them. Not one thing is on top of, embedded or superior to the other, they just feed into each other. …


You should learn how to download movies using torrents by yourself.

If you’re old enough to use a browser you should learn how to search for movies, download them with subtitles and watch them.

This is for several reasons:

  1. Copyright is rubbish.
  2. It will give you independence and set you on the protestant path of agency.
  3. It will make you understand the power that fiddling with things by yourself has.
  4. Netflix, news, facebook and traditional TV steal your attention making you into a zombie by way of convenience.
  5. If you are a girl or a woman, depending on the year…


So you want to train a binary classifier over strings, using state of the art language models. All you really want is an API that gets two groups of strings and an example usage. You don’t really want to know about masks and encodings and special tokens just yet, you just want to experiment a bit. Well there you go.

In this example we learn to identify past vs present tense in <50 examples.


So two problems I thought about:

  1. Say you have a neural net you want to send to a friend to use, but you don’t want this friend to steal your model, start improving it and selling it to others. How can you make this model work for the purpose it was made, but be impossible to adapt?
  2. Alice and Bob meet online and text for awhile. After some time, they grow very fond of each other and decide to take their relationship to the next level. Alas they are both already married to others. But, as sometimes is the case…

  1. Thoughts translated into words never pass intact. Words are merely a one dimensional description of multidimensional thoughts and for that one should not look at them as pure intention but instead vague pointers to a nonverbal truth, or vessels that have some truth. Sometimes they are coarse inaccurate pointers and at other times accurate. Sometimes they are targeted to a certain audience or time and will easily be misinterpreted. Other times they are general and easy to comprehend. Text is always an attempt at sharpshooting knowing beforehand the score will not be perfect.
  2. What was said in the past belongs…


The question of whether Machines Can Think… is about as relevant as the question of whether Submarines Can Swim.

- Edsger W. Dijkstra

Three preliminary notes:

  1. Intelligence and life are synonymous in my opinion, meaning you could replace all the occurrences of the word intelligence with the word life and this essay is still valid.
  2. I treat intelligence not as a discrete quality, but rather as a continuous spectrum. On this spectrum we can place different systems, stating whether they are more intelligent or less than other systems, but never being simply intelligent or simply unintelligent. Normally we would like…


A bunch of code without spaces fading out of focus

If you ever wondered what’s programming like, you might find this essay interesting.

I know at least some people view programming as a bit grey, too mathematical or uncreative. It is sometimes these things, but it’s also a bunch of other things.

If you only have time for a short video, this is the best explanation I’ve seen yet: http://video.disney.com.au/fantasia-sorcerers-apprentice

I’ve always liked it but it is only since I’ve become an experienced programmer that I’ve started to get emotional about it. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store