cognitive science
and more

In El Congreso, a short story by Jorge Luis Borges, the lead character, Alejandro Ferri, sets out to find the perfect language for a secret society whose aim is to create a congress that represents all of humanity. This story is fascinating in many ways; for example, you might ask how a society can be both secret and represent all of humanity at the same time. But I was especially intrigued by the constructed languages that Ferri considers (but not ultimately accepts) as the universal language.

Anyone who's ever learned a second language knows the feeling that language is unnecessarily complex: irregular verb conjugations, cases (i.e. modifying a noun to indicate its role in a sentence), etc. Awful! So what could be more convenient than a rational language that has been designed with a limited and fixed set of rules? A language of reason, or Lingvo de kialo in Esperanto!

Esperanto and Voläpuk are two such languages, both created at the end of the 19th century. Voläpuk, which I'd never heard of before reading El Congreso, doesn't appear to have stood the test of time. But Esperanto is alive and well; it might not have become the universal language that it was designed to be, but it has a small following, its own Wikipedia with over 200,000 articles, and it is supported by Google Translate and Duolingo (a free platform for learning languages).

I've taken a few Esperanto lessons on Duolingo, and it's ...

Read more »

Scientists publish less than they used to (by some measures)

A fascinating study by Daniele Fanelli and Vincent Larivière was published yesterday in PLoS ONE. It's a bibilometric study (i.e. about how scientists publish their research), and its main conclusion is that scientists do not publish more than they used to—or at least not by all measures. This conclusion is surprising, because it goes against the cynical-but-widespread belief that scientists nowadays try to publish as many papers as possible, with little regard as to whether these papers contribute anything.

Let's start with a basic fact: For decades, and year after year, the total number of scientific publications has been increasing exponentially. You can clearly see this in the figure below, taken from one of my previous blog posts.

So what drives this growth? Multiple things, probably. To start with the obvious: The world's population has grown, and the number of scientists has grown even more rapidly (i.e. it has become more common to be a scientist); as a result, scientists are publishing more papers in total.

But many people would point out another important driver of this growth: the "publish or perish" culture.

Scientists are under a lot of pressure to publish papers—if you don't publish enough, you're out. This pressure is relatively new, or at least it seems to have increased over time; and it stands to reason that scientists would respond to this pressure by publishing more papers. For example, whereas a scientist in the eighties might have worked ...

Read more »

How to write with your mind? (or: Decoding attention through pupillometry)

I'm very excited to announce that our article The Mind-Writing Pupil is now available at PLoS ONE! In this article, we describe a technique that allows you to—literally—write by thinking of letters. This sounds like a wild claim, but it's not; the technique is actually surprisingly simple. In the video below you can see a demonstration:

So how does this work?

First, let's look at the simple case in which there are only two letters: A and B. Both letters are presented on backgrounds that alternate between bright and dark; crucially, whenever the A is dark, the B is bright, and vice versa.

Now imagine that you are looking directly at the B. In this case, your eye's pupil would respond strongly to the brightness of the B (or rather its background); this is the pupillary light response: the constriction (shrinkage) of the pupil in response to brightness, and dilation (expansion) in response to darkness.

So if we would measure the size of your pupil while you're looking directly at the B, we would see that it follows the B's brightness. In this example, the B is initially bright, so the pupil would be small; then the B turns dark, so the pupil would become large; and then the B turns bright again, so the pupil would become small again. Therefore, we could simply measure how pupil size changes over time, and use this to determine with almost 100% certainty which of ...

Read more »

A simple explanation of character encoding in Python

Special characters are a pain for programmers, and a source of bugs. Whenever your code contains an accented letter, voil├Ā, funny-looking symbols appear; or, worse, your program crashes with an obscure error. Why does it have to be that hard!?

It doesn't. Character encoding is not that difficult once you understand the basic principles. Let's take a look.

Characters are interpretations

For a computer, there is no text, only bytes. Text is an interpretation, a way to visualize bytes in human-readable form. And if you interpret bytes wrong, you get funky-looking characters, or even an error. A character encoding is one specific way of interpreting bytes: It's a look-up table that says, for example, that a byte with the value 97 stands for 'a'.

Now let's consider these three bytes:


In Python 21, this is a str object: a series of bytes without any information about how they should be interpreted. Don't let the name confuse you: A str is not a string of characters; rather, it's a series of bytes that you can interpret as a string of characters. But the proper interpretation requires the proper encoding, and the problem is: A str doesn't know its own encoding!

Now let's turn to actual Python:

# Mystery string!
byte_string = chr(195) + chr(167) + chr(97)

We have three bytes (195-167-97), but no idea what they stand for. How can we decipher these bytes into actual text? Well, we need an ...

Read more »

The psychology of object-oriented programming

Object-oriented programming is a beautiful concept with a bad reputation. Many programmers, especially those without formal training, avoid it, because they believe that objects are complicated and abstract; in addition, many programmers don't have a clear understanding of what objects are good for. Why do you need objects at all? Can't you do everything with functions and loops?1

Object-oriented programming serves several purposes. The one that you hear most is that it 'reduces code redundancy'; that is, it avoids you from having to type the same thing twice. While this is true, this is mostly relevant for large projects, in which duplicate code causes all kinds of problems. But object-oriented programming serves another important purpose, one that is useful for large and small projects alike: It's a way to think about programming that resembles how we think about the world.

To introduce object-oriented programming, let's start with an example that embodies its very opposite:

i = sqrt(9)

Here we apply a function (square root, usually written as sqrt) to a number (9). The result is another number (3), which is stored in a variable (i). This example illustrates a clear distinction between the data (the number 9 and the variable i) and the function that is performed with this data (sqrt()). This data-function distinction is characteristic of mathematics and traditional, non-object-oriented programming.

But now consider this:

The cuteness. Sources (CC-by license): Wikimedia and again Wikimedia.

We immediately recognize these objects as kittens. And we roughly ...

Read more »