Folds, maps, and filters

Why use folds, maps, and filters?

A quick glance reveals that adler32_foldl isn’t really any shorter than adler32_try2. Why should we use a fold in this case? The advantage here lies in the fact that folds are extremely common in Haskell, and they have regular, predictable behavior.

This means that a reader with a little experience will have an easier time understanding a use of a fold than code that uses explicit recursion. A fold isn’t going to produce any surprises, but the behavior of a function that recurses explicitly isn’t immediately obvious.

— Chapter 4: Functional programming

— Real World Haskell

— by Bryan O’Sullivan, Don Stewart, and John Goerzen

2012.05.20 Sunday ACHK

Startup 12

What is technology? It’s technique. It’s the way we all do things. And when you discover a new way to do things, its value is multiplied by all the people who use it. It is the proverbial fishing rod, rather than the fish. That’s the difference between a startup and a restaurant or a barber shop. You fry eggs or cut hair one customer at a time. Whereas if you solve a technical problem that a lot of people care about, you help everyone who uses your solution. That’s leverage.

— How to Make Wealth

But isn’t the consulting company itself a startup? No, not generally. A company has to be more than small and newly founded to be a startup. There are millions of small businesses in America, but only a few thousand are startups. To be a startup, a company has to be a product business, not a service business. By which I mean not that it has to make something physical, but that it has to have one thing it sells to many people, rather than doing custom work for individual clients. Custom work doesn’t scale. To be a startup you need to be the band that sells a million copies of a song, not the band that makes money by playing at individual weddings and bar mitzvahs.

— How to Fund a Startup

— Paul Graham

2012.05.19 Saturday ACHK

Laser mice

The laser mouse uses an infrared laser diode instead of a LED to illuminate the surface beneath their sensor. As early as 1998, Sun Microsystems provided a laser mouse with their Sun SPARCstation servers and workstations. However, laser mice did not enter the mainstream market until 2004, when Paul Machin at Logitech, in partnership with Agilent Technologies, introduced its MX 1000 laser mouse.

This mouse uses a small infrared laser instead of a LED and has significantly increased the resolution of the image taken by the mouse. The laser enables around 20 times more surface tracking power to the surface features used for navigation compared to conventional optical mice.

— Wikipedia on Optical mouse

2012.05.18 Friday ACHK

Forensic Accounting

Benford’s law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. According to this law, the first digit is 1 about 30% of the time, and larger digits occur as the leading digit with lower and lower frequency, to the point where 9 as a first digit occurs less than 5% of the time.

Mathematical statement

… this is the distribution expected if the logarithms of the numbers (but not the numbers themselves) are uniformly and randomly distributed. For example, a one-digit number x starts with the digit 1 if 1 <= x < 2, and starts with the digit 9 if 9 <= x < 10. Therefore, x starts with the digit 1 if log 1 <= log x < log 2, or starts with 9 if log 9 <= log x < log 10. The interval [log 1, log 2] is much wider than the interval [log 9, log 10] (0.30 and 0.05 respectively); therefore if log x is uniformly and randomly distributed, it is much more likely to fall into the wider interval than the narrower interval, i.e. more likely to start with 1 than with 9.

Explanations

Outcomes of exponential growth processes

The precise form of Benford’s law can be explained if one assumes that the logarithms of the numbers are uniformly distributed; for instance that a number is just as likely to be between 100 and 1000 (logarithm between 2 and 3) as it is between 10,000 and 100,000 (logarithm between 4 and 5). For many sets of numbers, especially sets that grow exponentially such as incomes and stock prices, this is a reasonable assumption.

Applications

In 1972, Hal Varian suggested that the law could be used to detect possible fraud in lists of socio-economic data submitted in support of public planning decisions. Based on the plausible assumption that people who make up figures tend to distribute their digits fairly uniformly, a simple comparison of first-digit frequency distribution from the data with the expected distribution according to Benford’s law ought to show up any anomalous results.

Following this idea, Mark Nigrini showed that Benford’s law could be used in forensic accounting and auditing as an indicator of accounting and expenses fraud. In the United States, evidence based on Benford’s law is legally admissible in criminal cases at the federal, state, and local levels.

Limitations

Benford’s law can only be applied to data that are distributed across multiple orders of magnitude.

— Wikipedia on Benford’s law

2012.05.15 Tuesday ACHK

Batman: Arkham Asylum

Batman: Arkham Asylum is an award-winning 2009 action-adventure stealth video game based on DC Comics’ superhero Batman.

Arkham Asylum, written by veteran Batman writer Paul Dini, is based on the long-running comic book mythos, as opposed to most other Batman games, which are adaptations of the character in other media besides the source material.

— Wikipedia on Batman: Arkham Asylum

2012.05.12 Saturday ACHK

Computer games, 4

Like many software developers, my introduction to programming was my Dad telling me if I wanted to play video games at home, I had to write them first. Tough love hurts. Home game consoles were the gateway drug of choice for parents who imagined their children as young programmers, a sneaky way for parents to trick their lazy game-playing kids into learning BASIC.

— Rediscovering Arcade Nostalgia

— Jeff Atwood

2012.05.08 Tuesday ACHK

Energy, matter, and information equivalence, 2

Another link is demonstrated by the Maxwell’s demon thought experiment. In this experiment, a direct relationship between information and another physical property, entropy, is demonstrated. A consequence is that it is impossible to destroy information without increasing the entropy of a system; in practical terms this often means generating heat.

Another, more philosophical, outcome is that information could be thought of as interchangeable with energy.

— Wikipedia on Information

2012.05.03 Thursday ACHK

Robot Wisdom

.

The traditional ideal:
A world ruled by wise, loving, responsible elders

The present reality:
A world under the thumbs of utterly cynical predators

The strategic analysis:
Their weak point is their need to rationalize their acts, by sophistries

The radical proposal:
Create a computer model of the human predicament, that can unflinchingly put the lie to their rationalizations (ie: Robot Wisdom)

.

– Robot Wisdom, Jorn Barger

.

.

.

2010.02.01 Monday ACHK

Principia Mathematica, 2

Wittgenstein (e.g. in his Lectures on the Foundations of Mathematics, Cambridge 1939) criticised Principia on various grounds, such as:

It purports to reveal the fundamental basis for arithmetic. However, it is our everyday arithmetical practices such as counting which are fundamental; for if a persistent discrepancy arose between counting and Principia, this would be treated as evidence of an error in Principia (e.g. that Principia did not characterize numbers or addition correctly), not as evidence of an error in everyday counting.

The calculating methods in Principia can only be used in practice with very small numbers. To calculate using large numbers (e.g. billions), the formulae would become too long, and some short-cut method would have to be used, which would no doubt rely on everyday techniques such as counting (or else on non-fundamental – and hence questionable – methods such as induction). So again Principia depends on everyday techniques, not vice versa.

Wittgenstein did, however, concede that Principia may nonetheless make some aspects of everyday arithmetic clearer.

2012.05.01 Tuesday ACHK

Residual self-image

Residual self-image is the concept that individuals tend to think of themselves as projecting a certain physical appearance, or certain position of social entitlement, or lack thereof. The term was used at least as early as 1968, but was popularized in fiction by the Matrix series, where persons who existed in a digitally created world would subconsciously maintain the physical appearance that they had become accustomed to projecting.

— Wikipedia on Self-image

2012.04.26 Thursday ACHK

Firmware 3

這段改編自 2010 年 3 月 20 日的對話。

「韌體」本身是「軟件」,因為它是由一堆程式指令所組成。但是,你亦可以把「韌體」看成,介乎「硬件」和「軟件」之間一個概念,原因是:

第一,「韌體」是直接寫入電腦的電子零件之中,而不是儲存於硬碟(hard disk drive)之內。

第二,為一個硬件設計和編寫「韌體」時,會直接受制於,該個硬件自身的設定和侷限。

第三,一個硬件出廠前,會安裝好「韌體」。自此以後,就很少會修改更換,因為那相對複雜困難,而且通常也不會帶來明顯的好處。

— Me@2012.04.24 

2012.04.24 Tuesday (c) All rights reserved by ACHK

Portal

時空幻境 3

Portal is a 2007 single-player first-person puzzle-platform video game developed by Valve Corporation.

The game primarily comprises a series of puzzles that must be solved by teleporting the player’s character and simple objects using “the handheld portal device”, a device that can create inter-spatial portals between two flat planes.

By Kaini [CC-BY-SA-3.0], from Wikimedia Commons

The game’s unique physics allows momentum to be retained through portals, requiring creative use of portals to maneuver through the test chambers.

— Wikipedia on Portal (video game)

2012.04.21 Saturday ACHK

Meta 3

… the people who made money from the gold rush were not the gold miners. It was guys named Levi Strauss and Crocker, and folks who ran banks, and people who sold jeans, and sold picks and axes.

I think ultimately in the long term that the money that will get made in Minecraft will not be about Minecraft, but will be about the services and products that get introduced into it. And so that’s what’s most interesting to me about Minecraft, is that the ecosystem, it’s almost an American history lesson.

— Rich Hilleman

— Getting EA Ready for the Future

— Brandon Sheffield

— Gamasutra

2012.04.11 Wednesday ACHK

Wittgenstein’s Tractatus

種子意念 2.1.5

The Tractatus Logico-Philosophicus is an unusual example of a self-refuting argument, in that Ludwig Wittgenstein explicitly admits to the issue at the end of the work:

    “My propositions are elucidatory in this way: he who understands me finally recognizes them as senseless, when he has climbed out through them, on them, over them. (He must so to speak throw away the ladder, after he has climbed up on it)”. (6.54)

However, this idea can be solved in the sense that, even if the argument itself is self-refuting, the effects of the argument elicit understandings that go beyond the argument itself.

— Wikipedia on Self-refuting idea

2012.04.10 Tuesday ACHK

Godel 1.1

A major early proponent of formalism was David Hilbert, whose program was intended to be a complete and consistent axiomatization of all of mathematics. Hilbert aimed to show the consistency of mathematical systems from the assumption that the “finitary arithmetic” (a subsystem of the usual arithmetic of the positive integers, chosen to be philosophically uncontroversial) was consistent (i.e. no contradictions can be derived from the system).

Godel’s conclusion in his incompleteness theorems was that you cannot prove consistency within any axiomatic system rich enough to include classical arithmetic.

— Wikipedia on Formalism (mathematics)

2012.04.05 Thursday ACHK