What is the #Occupy Movement?

The Intellectual Roots of the Occupy Movement

#occupy wall street poster

The #Occupy Wall Street movement is primarily a Dadaist expression. Dada originated out of anti-war sentiment during World War I. Participants classified it as a protest against the bourgeois nationalism and colonialism. They also saw it as a protest against intellectual conformity during wartime.

According to Wikipedia:

Many Dadaists believed that the ‘reason’ and ‘logic’ of bourgeois capitalist society had led people into war. They expressed their rejection of that ideology in artistic expression that appeared to reject logic and embrace chaos and irrationality. For example, George Grosz later recalled that his Dadaist art was intended as a protest “against this world of mutual destruction.”

Already at this point, there is a clear resemblance to the apparent chaos and disorganization of the Occupy Movement and the Dadaist Movement. However, this is only where the roots of the movement began. There is a very rich cultural and revolutionary history behind the Occupy Movement.

Situationists and the French Protests of ’68

The Avant-garde Dadaist Movement paved the way for the Situationist International group in 1957. The Situationists were primarily a restricted group of European revolutionaries spanning across several borders. The other heritage they drew from was the Marxist ideology. They were very involved in creating situations where people could experiment with alternatives to the group think of society. They created fields such as Unitary Urbanism and Psychogeography. Détournement is a particularly important practice of Unitary Urbanism.

Civil Unrest - France May 1968This group played a large role in supporting the General Strike of May 1968, in France. This strike lasted two weeks and brought the economy of France to a halt. Nearly 11 million people went on strike for the entire two weeks of the protest. This counted for nearly a quarter of nearly 49.9 million French citizens in 1968 and two thirds of the working population. The movement caused massive changes in society as a result of the total disaster it caused. Initially, it focused on educational system. Then it branched out into workers.

The Situationists called for workers to occupy the factories. They established the Council for Maintaining the Occupations. This instituted a democracy with equal voice for all participants:

The council implemented a policy of equal representation for its participants. It was described by Situationist René Viénet as “essentially an uninterrupted general assembly, deliberating day and night. No faction or private meetings ever existed outside the common debate.” It was formed on the evening of May 17, by supporters of the Sorbonne Occupation Committee.

The factory occupation was to prevent workers from being locked out of the factory. It resulted in the workers taking over and directing the factories through a democratic process.

Some may say that similarities abound between the French protests of ’68 and the Occupy Movement. Sure, they were both started by culture jamming societies. You could say they are nearly the same play from very similar organizations. Unfortunately, they were not organized in the same way and a very different intellectual history make them entirely unlike. These two events unfolded drastically differently due to many differences and concerns that may not have been thought out.

The Reality of Occupy

The Occupy Movement was started by Adbusters, a Canadian culture jamming publication and organization. It was formed in 1989, in Vancouver, British Columbia, by Bill Schmalz and Kalle Lasn (author of Design Anarchy). Adbusters describes themselves: “We are a global network of culture jammers and creatives working to change the way information flows, the way corporations wield power, and the way meaning is produced in our society.” Culture Jamming, coined in 1984, is a modern example of détournement, revived in the 1970s with the punk movement.

The Occupy Movement was inspired by the Cairo’s Tahrir Square protests, and the Spanish Indignants. The Egyptian Revolution wanted to overthrow an entire government regime. The Spanish protests have a little more in common with the Occupy Movement:

Even though protesters form a heterogeneous and ambiguous group, they share a strong rejection of unemployment, welfare cuts, Spanish politicians, the current two-party system in Spain between the Spanish Socialist Workers’ Party and the People’s Party, as well as the current political system, capitalism, banks and bankers, political corruption and firmly support what they call basic rights: home, work, culture, health and education.

Notice again, there is a definite similarity of the composition of the group and the demands between the Occupy Movement and the Spanish Protests. Occupy is a group of really different people all rallying around demands that each member has. Their focus is wide and there are a diverse range of needs represented.

Democracia real YA

A grassroots movement organized in March 2011 and became known as ¡Democracia Real YA!, which apparently is also the name of the social network that was used to organize it. This organization has created a manifesto and has brought about a (broad) set of demands and became an actual political platform to operate from. The real momentum behind organizing ¡Democracia Real YA! came from a prior timeline: On 29 September 2010, labor union strikes broke out in Spain. More strikes happened on 27 January 2011, when unions in Catalonia, Galicia, and Basque Country also protested. Both of these strikes were for reasons similar to the Wisconsin Labor Strikes in February 2011 and March 2011. On 7 April 2011, 5,000 people organized a protest in Madrid around the demands of Jovenes sin Futura (Youth Without a Future). On 1 May 2011, a riot broke out in Barcelona and destroyed many businesses in the richest neighborhood. The first occupation planned by the ¡Democracia Real YA! came on 13 May 2011. Two days later, 50,000 protesters joined in and showed support. The protests have continued since (over 6 months).

Interestingly enough, the Spanish protests have also been compared to the French Protests of ’68. The similarities: both started around education and employment. Both were in countries small compared to the US. Sure, there was some unrest and an area of Barcelona was trashed, but it has not caused a whole third of the country to cease their daily activities. It has not brought Spain’s economy to it’s knees.

The Intellectual Heritage of Modern American Protests

During the period of 1954-1968, the most recent African-American rights movement happened. Voting rights and racial desegregation were brought about in the south. The Black Power Movement also happened. It sought to bring about a true relief of oppression from white Americans and a power balance with white Americans. This movement was steeped in non-violent practices.

Second wave feminism emerged during this period, too. Women worked hard to gain equality in society. Women worked to attain equal pay, and equal footing economically. More generally, women worked hard to dispel the media’s portrayal of women’s role in society. This movement was also rooted in non-violence to achieve its goals.

Parallel to the development of the Situationists in Europe, the development of Happenings came about in the US during 1957. Allan Kaprow coined the term to describe performances happening that spring on George Segal’s farm. These happenings were meant to involve the audience and draw them into the art, to interact with it and become a part of the performance itself. In Kaprow’s words, “The line between the Happening and daily life should be kept as fluid, and perhaps indistinct, as possible.” A happening depends entirely on the audience that participates. Since the audience changes every time, each performance is never the same. This idea would go on to inspire others.

In San Francisco, The Suicide Club formed in 1977 by Gary Warne (also the founder of SantaCon). This secret society involved itself in urban exploration and social exploits borrowing ideas from happenings. They started The Billboard Liberation Front (one of the first US culture jamming groups) as a result of their bridge climbing antics. They performed street theater — sometimes this involved riding the streetcars naked. They hosted elaborate games in strange places like a cemetery. They also infiltrated organizations — such as the Unification Church and the American Nazi Party.

In 1986, ex-Suicide Club members founded the Cacophony Society. According to their website:

The Cacophony Society is a randomly gathered network of individuals united in the pursuit of experiences beyond the pale of mainstream society through subversion, pranks, art, fringe explorations and meaningless madness.

This group is responsible for creating Burning Man during Zone Trip #4. One of the co-founders, Kevin Evans, conceived it as “a dadaist temporary autonomous zone with sculpture to be burned and situationist performance art.”

The idea of the Temporary Autonomous Zone, came to Hakim Bey as early as 1985 while he was studying pirate utopias. The book on TAZ (Temporary Autonomous Zones) was published in 1991. The book skirts around defining the meaning of the TAZ, leaving the term as a floating signifier. Fortunately, the context of the book creates enough of a boundary around the meaning that one can grasp in intuitively. A protest, a happening, a Burning Man event, a Lost Horizon Night Market, a ComicCon, and the Oregon Country Fair are all examples of a TAZ (and happening) to one degree or another.

Hakim’s book on the TAZ begins with a section entitled “CHAOS: THE BROADSHEETS OF ONTOLOGICAL ANARCHISM”. At this point, we can see that the Situationist legacy had been united with the anarchic tendencies of the US Cacophony Society and earlier Suicide Club. Most likely the notions presented so shortly after Adbusters was founded would have been on the radar of Lasn, since Lasn is such a proponent of the anarchy of design and ideas. It would seem that much of the ideology behind the Cacophony Society would have made it into the minds of those planning the Occupy event.

What Does This Mean for Occupy?

Politically, the French protesters of ’68 failed. President De Gaulle tried to fight back with Police action. This was not met well and streets broke out with battles against the police. Fearing a revolution, President De Gaulle fled to Germany, staying at a French military base. He dissolved the National Assembly and held re-elections. His party emerged even stronger after the elections. The aftermath only included sweeping changes to French society because so much of society was effected by a fourth of France protesting.

Contrasted to the French protests of ’68, Occupy is definitely not a large movement concentrated in one area. It is not a sizable force that can recon with a cities economy, much less an entire country’s economy (maybe a neighborhood economy). Now, the Occupy movement is being confronted with police force in many states. If it were to get violent, that would be the end of the movement. Fortunately, there is a great heritage of non-violent protesting in the US. If this were not the case, the moment a violent fight broke out between protesters and cops, the movement would be dismissed and would have no political power. There is no way this movement as it stands will be able to bring about the social change the French protesters brought about through force.

Occupy may appear to be a grassroots movement, but it only became one after Adbusters manipulated the psychogeography by placing posters around the area Occupy Wall Street would happen. Unlike both the French protests of ’68 and the Spanish Indignants, it did not grow out of groups already protesting. Sure, there were union strikes in Wisconsin. Where were students already protesting about the educational system? The sentiment was not nearly as widespread as it was in May ’68 in France. There is a similarity between Spanish protesters and Occupy, the length of time occupations have been happening. Occupy has been going on for about 1/3 of the time as the Spanish Indignants, and the protests have lasted 1/3 of the time. They do seem to be very similar in action.

Occupy is seemingly artificial, not to disqualify it, but it was not an organic grassroots movement where lots of people decided to start protesting. It is an idea piggybacking on generally felt sentiments, sentiments felt very deeply by some. It was provoked, not by the government or economy itself, but rather by a culture jamming collective with a nod towards ontological anarchism. Occupy is a work of art. It is a readymade art installation and a happening. Kaprow and Duchamp would be proud.

Occupy quickly evolved into a special type of TAZ. It reminded people that there is more to life than this rat race of consumerism and capitalism. People’s belief in reality must be suspended when coming into contact with Occupy. If someone’s beliefs are not suspended, they, like many others, will probably be in conflict with Occupy. They might yell, “Get a job!”, as I heard many times around Occupy Portland. This is a city bound Zone Trip #4, the origin of Burning Man. As Matt Taibbi phrased it:

This is a visceral, impassioned, deep-seated rejection of the entire direction of our society, a refusal to take even one more step forward into the shallow commercial abyss of phoniness, short-term calculation, withered idealism and intellectual bankruptcy that American mass society has become. If there is such a thing as going on strike from one’s own culture, this is it. And by being so broad in scope and so elemental in its motivation, it’s flown over the heads of many on both the right and the left.

As Occupy stands, it cannot be sustained for long. If their sentiments are true, let them stop being a non-commissioned art installation occupying public space. It needs to get off the lawn, before too many anti-protest protests break out.

What Occupy Can Do to Be Taken Seriously

Occupy needs to realize it is a happening, a deeply heartfelt, everyday performance art gathering. It needs to realize that the needs of its actor-participants influence the outcome. The needs of its members must be met. Occupy represents a large cross section of people everywhere on Maslow’s hierarchy of self actualization (let us not delve into it being a hierarchy, just needs that people have). At Occupy, peoples needs include: physiological (air, water, food, sanitation, etc.), safety (health, shelter, clothing, employment, property, etc.), love & belonging (friends, family, sexual intimacy), esteem (to be accepted, valued, and respected), and self-actualization (morality, creativity, spontaneity, problem solving, lack of prejudice, and acceptance of facts).

This provides an interesting strain on Occupy. It is based on volunteerism, which is a very hard way to manage social services. The strain becomes pronounced in places like Portland where Occupy Portland held a march that ended in occupation of three blocks of parks — parks where a few homeless people already slept. Some of them didn’t know what was going on, but it was “cool” that all of these people came to join them. Word of the camp spread and soon there were a lot of actual homeless people with many needs living in the camp. Even today, there has not been any funding sought out to provide mental health and drug addiction counselling to people that desperately need it.

Occupy has a real need for expert facilitation to sort out the needs of people that are a part of the movement and firmly establish groups in charge of meeting those needs. They need to be groups separate from the people with the needs, so there is accountability. There needs to be a definite schedule for meetings around these different needs and concerns, not like the currently ad hoc situation. This would allow more representation in the spokes council meetings. General Assemblies seem to be derailed because of the number of needs represented by each participant.

In Portland at least, passers by and the media have noticed the homeless people, the drug problems, and the mental health problems. Having continuing issues around these untended needs presents many issues to having a consistent and positive view of Occupy by outsiders. Finding a way to take care of these needs will improve communities and improve the outlook for Occupy.

The language of the original poster for the Occupy Wall Street gathering, “What is our one demand?”, failed to specify any specific demand(s) but rather left it up to the Occupy group to democratically decide a set of demands, or rather, needs. Adbusters left demands wide open, greatly contrasting with the origin of the Spanish protests. This needs to happen soon. Once the needs and demands are sorted out they can be used to drive powerful changes that people can rally behind.

There are so many ways Occupy could incorporate and become a driving force for local economies. By doing so, Occupy would be setting an example for others to follow. A lack of skilled workers may arise, but this really only presents an opportunity to partner with local organizations and create training programs.

The environment of Occupy’s TAZ is ripe for experimentation and innovation. Occupy needs to involve the right people and generate ideas that spread and cause measurable change in society. Once people’s needs are met and actual progress and community improvement is made by Occupy, people will start taking it seriously.

Drunk Drivers Make Me Sad

I normally curse reckless drivers and hope they get what’s coming to them. Except for tonight. This driver was being far too reckless — and I was concerned for them.

A really nice silver car came zooming along in the carpool lane, engine furious, moving at least 35 miles per hour faster than anyone else on the bridge. The driver then cut in front of three cars in front of me and in the next lane over while changing into the rightmost lane. What really concerned me was how fast he was approaching the car ahead of him. Both cars disappeared around exit onto 14E towards Camas, WA — my exit also.

I followed them, lagging by about a minute. I was almost expecting an accident as I exited the I-5N to head east. I saw an intact tire towards the side of the road and I swerved to avoid it. I saw smoke. Then I saw glass. I braced to see the worst.

Ahead, a car had pulled over. It’s emergency blinkers flashed. Further ahead and opposite the tire, the silver car lay upside down without a tire on the front driver’s side and the back angled up towards the air.

As I passed the upside down car, I noticed the driver moving trying to get out. I drove about a hundred feet ahead and pulled over. Other cars were starting to pull over as well. I was walking up to the silver car with my cell phone in hand and 911 already keyed in. I saw the driver get out of the car. He said, “I’m alright.” He then proceeded to tell me that he had a few drinks and that he wanted to leave and asked if I would give him a ride a few exits toward the hospital. I said that I would, but really intended to call 911.

He turned around and went back to his car. As I turned to look at my car and dial, another car pulled over slightly ahead of me and behind my car. I heard a crash behind me and whipped around to see that another car had been hit by a truck right by the silver car’s tire. Two people got out of the Jeep that just pulled over and asked if I had dialed 911 as my finger had pushed the call button and I told them, “I’m calling right now”. I spoke with dispatch to tell them where this was happening — just north of the I-5 bridge on the off ramp to 14E. She told me that a team was on the way.

A guy wearing black came to have a look at the people involved in the accidents. This man was a Navy medic. He inspected the driver and thought he might have a concussion from the forehead and temple injuries. There was also a nurse who was doing an assessment on some of the people closer to the secondary accident.

An ambulance, fire truck, highway patrol officer and a local sheriff arrived just a few minutes afterward. The emergency crew responded to the secondary accident. The lady in the car that was hit in the rear was slowly extracted from the car and put into a stretcher and loaded into the ambulance. The silver car’s driver, suspected of intoxication and possibly marijuana (he was in possession of a pipe, which was laying in the open with his stuff), was being examined by the sheriff. The police took my information and starting taking notes on my recollection. I was cleared to leave.

I was tired. I walked back to my car. I got in, started it up, and drove home.

I thought, at one time, I could have been that reckless driver. If I hadn’t had passed out and fell down as I was leaving Rotture a month ago, I could have gotten into my car and drove off. I probably wouldn’t have driven so fast, but there’s no telling what I would have done that drunk. I basically passed out that night from alcohol. If had got into my car, drove off, then passed out — I would have been in really bad shape and others might have too.

I didn’t get a chance to touch my car that night, but I still ended up in an ambulance. I woke up at OHSU the next morning and took the bus back to downtown Portland and had breakfast at the Pearl Bakery. Then I walked to my car. I still felt terrible, and probably shouldn’t have driven my car that morning. I went to my Portland office, drank water, chatted with a friend online and passed out on the futon.

I now have a great respect for alcohol and how much of a poison it is. I still drink, but I’m now really responsible about it. I don’t want to injure other people. I also don’t want to injure myself. There’s enough to worry about without having drunkenness ruin your day. The next time I hear a story about a drunk driver, I’m probably going to cry. It’s so sad that it happens, especially when it’s so preventable.

What’s The Big Deal About Transgender Rights?

Chaz Bono is going to be on Dancing with the Stars. For people who don’t know, I’m reluctant to let you in on the fact that he’s transgender. He was assigned to the female gender at birth, but didn’t fit the mold. People who know about his past have conniptions — or at least they still want to classify him as a woman, and then say that what he’s doing is all wrong and messed up (or sinful in some cases). For more on those type of comments, I’ll direct you here.

I will bring up one nasty comment from The Hollywood Review. A person who’s handle is Bellcindy wrote, “I do not hate Chaz as a person. I just resent the media shoving so much of anyone’s personal life choices down our throats.” The problem I have with this statement is it wouldn’t apply to people who are similar to Bellcindy. The personal lives and choices of hetro-normative people are constantly shoved down everyone’s throats. TV would have no substance to it if that were not the case. There would be no sitcoms, no reality TV, and no soap operas if it were not for constantly having hetro-normative life choices presented in the media. Bellcindy (and to all those out there like you), I’m sorry to inform you that your statement is just plain ignorant of reality.

Transgender people get to deal with many things in addition to harassment and abuse. For instance, the US (or at least now days, the SSA) doesn’t recognize the gender that one lives in, but rather the gender one was assigned at birth. The only exception is when one has had sex reassignment surgery and a letter from the surgeon is presented to the SSA (Social Security Administration). As of last year (see here), passports can be changed if one gets a letter from a doctor saying they have been undergoing clinical therapy towards living in the other sex (at least two years of it, otherwise a temporary passport is issued).

Some states do not recognize transgender people as their lived gender. There’s the question of, “Does his drivers license says M or F under sex?” In Oregon, one is able to change the sex marker with a notice from a licensed psychologist stating that one has been living as their intended sex for two years. This is not true in all states; other states that do allow it have differing requirements.

In a few states, one can have their birth certificate amended with the new gender once the surgery has happened. There are states in which the new gender is not recognized, even if the person has had surgery. Those states also make it nearly impossible for a transgender person to get married.

In some states (such as Oregon, if I remember), it is illegal for a person to use a public (multi-stall) restroom designated for the opposite gender (according to one’s state recognized gender on their ID). At the state level it becomes an issue of, “Is it legal for me to be who I am? If it is, what protections of my rights are there? If I were attacked or harassed, would I just be mocked in the justice system, or would someone uphold and respect my right to exist?” All of these questions and more are a daily reality for most transgender people.

I tend to dislike people who are narrow minded enough to define who a person is based on what is between their legs, and then expect that person to always live up to what the other thinks it means to have those genitalia. Then, when the gendered person deviates from the assigned gender, they are coerced (by humiliation, punishment, abuse) into conforming to the expectations others have for how others have gendered them.

Unfortunately, there are far too many of these people in the world. Unfortunately, people make laws that may discriminate against transgender people based on the assumption that having a penis makes one attracted to women, and that if one has a vagina they were meant to be penetrated by a man (with a penis, of course). GOD FORBID a man who doesn’t have a penis whom is attracted to women and sexually aggressive. It goes against their moral fiber.

It makes the world seem like an elementary playground where rules are arbitrarily created by the majority — a majority unable to think about other people and other experiences because they are not mature enough. Each one of them thinks they are the whole of the universe. Anyone who seems similar to them, but doesn’t conform to how they would behave is marginalized by them because they aren’t acting right. This happens no matter who the majority is, so it is not about hetero-normative people — it’s about marginalization through group think that becomes enforced as religious dogma in the resulting group.

The big deal about transgender rights is not just about transgender people. It is about making a more just, open, and loving society in which anyone can be free to express themselves without fear of being marginalized because they are different than other people. To finish this off, I’ll quote from my friend Maymay’s recent post, “That’s why ostracism is so powerful and so harmful: it is the epistemic equivalent of rejecting the instrument of liberation being offered.”.

Quick Mediterranean Nachos

I came home from a four mile walk/jog and did my stretches. Hunger came and I wanted something fast. Nachos!, I thought. I didn’t have cheddar or Colby-Jack cheeses, nor the salsa. Quick to think of substitutions, I realized I had feta cheese and spaghetti sauce.

I collected those ingredients, put tortilla chips on a plate, poured a little spaghetti sauce on top, then crumbled some feta cheese on top. I microwaved it for one minute — which could have been a minute and 10 instead. I took them out, let them cool off to a tolerable temperature and dug in.

If I had thought this through a bit more, I would have concocted this:

  • Tortilla chips
  • Pasta Sauce
  • Sliced Mushrooms
  • Chopped Olives (preferably green)
  • Chopped Green Onion
  • Capers
  • Crumbled feta cheese

Hoping that I had created something original, I Googled for “Mediterranean Nachos”. Damn you Betty Crocker! You had to come up with everything first didn’t you. At least my recipe was different than their recipe. Their recipe had diced tomatoes, but no sauce. No mushrooms. No capers. It had sun dried tomatoes — which is a cool idea, but somewhat cliche.

To make a better version of their recipe (IMHO), substitute fresh mozzarella (in brine) for the feta, change out basil for the green onion, hold the olives (if you want), and drizzle wine vinegar and olive oil on top. Actually, hold that thought. I haven’t tried it yet, but it sounds good in theory. If you try it, let me know how it goes…

The State of Functional Programming in PHP 5.3.x

A few weeks ago, I started looking into the possibility of functional programming in PHP. I stumbled across the capability of defining anonymous functions — starting with PHP 5.3.0. These can be used to define closures with bound variables and also for partial application or currying. Higher order functions can also be defined.

All anonymous functions are implemented through the internal Closure class — which is strange since anonymous functions can be used to implement closures, but anonymous functions are not closures. It takes advantage of the __invoke() magic in PHP 5.3.x. This means that alternate implementations or libraries taking further advantage of anonymous functions could be created rather easily.

Anonymous Functions

It is very easy to define an anonymous function:

$variable = function ($arg) {
  return $arg+1;

This is very close to what JavaScript programmers typically call a closure, for reasons we’ll see shortly.

Note: In PHP 5.4.x (currently in alpha — development preview), an anonymous function defined inside of a class can use the $this variable to access class properties and methods.

Closures and Bound Variables

A closure is an anonymous function that encloses part of the external scope surrounding it. Here’s an example:

// Assign value to variable to be bound
$variable = 3;
// Create a closure using a variable outside of the scope of the anonymous function.
$closure = function ($arg) use($variable) {
  return $arg + $variable;

One must explicitly bind variables in the outside scope by using the keyword use. Binding variables in PHP is, by default, through early binding. This means that the values seen by the anonymous function are the values that were bound at the time the function was defined. One can implement late binding by passing in the variables to be bound by reference in the use parameters. For example:

// Define the greeting
$greeting = "Hello!\n";
// Define a function and bind a variable by reference (late binding)
$f = function() use(&$greeting) {
  echo $greeting;
// Run the closure
// Change the greeting
$greeting = "Hi!\n";
// Run the closure

This would output:


JavaScript uses late binding, where the value seen is whatever the bound variable’s value is at the time of the anonymous function’s execution. Variable scope overlaps one level of nesting — closures can access variables in the scope directly containing it. In PHP, I have nonesuch luck. This is why anonymous functions are commonly called closures in JavaScript, it is so common to use its implicit binding that most programmers don’t notice that they might not even be creating a real closure. (Since the variables in the containing scope are always available to the anonymous function (unless there are optimizations in the interpreter or compiler), it might technically still be a closure.)

Partial Application of Functions

If there is a general function that accepts many variables and one wants to create a function that fixes most of the variables, one can partially apply a function. This takes a function with a certain number of parameters and returns a function that accepts fewer parameters. For instance, I can take a saddle function (a 3-d function that looks like a saddle) and turn it into a 2-d parabola (which is actually the curve at y = 5):

$general_function = function($x, $y) {
  return $x*$x - $y*$y;
$partial_function = function($x) use($general_function) {
  return $general_function($x, 5);

Higher Order Functions

Higher order functions are functions that accept functions as their parameters. A common higher order function is the compose function. It accepts two functions and returns a function. All of the inputted functions must accept the same number of parameters and resulting function will accept the same number of parameters.

function compose(&$f, &$g) {
  // Return the composed function
  return function() use($f,$g) {
    // Get the arguments passed into the new function
    $x = func_get_args();
    // Call the function to be composed with the arguments
    // and pass the result into the first function.
    return $f(call_user_func_array($g, $x));

Other common functions are map, filter, & fold (reduce in some cases).

The function map takes an array and a function, applies the function to each element in the array, returning the resulting array:

// Convenience wrapper for mapping
function map(&$data, &$f) {
  return array_map($f, $data);

The filter function takes an array and a function (boolean). It applies the function to each element in the array and appends it to the array if the function returns true.

// Convenience wrapper for filtering arrays
function filter(&$data, &$f) {
  return array_filter($data, $f);

The fold function aids in taking an array and turning it into a scalar (single) value:

// Convenience wrapper for reducing arrays
function fold(&$data, &$f) {
  return array_reduce($data, $f);

// sum over an array using the fold function
$sum = function ($values) {
  return fold($values, function($u, $v) {
    return $u += $v;

Functions as Objects

Unfortunately, the class which is implemented internally for anonymous functions does not support instantiation. This has the side effect of not allowing the Closure class to be extended. This is not a huge deal, since the __invoke() magic could be used to create a class that can be used the same way as the internal class. For instance:

class Lambda {
private $anonymous;
  public function __construct($f) {
    $this->anonymous = $f;
  public function __invoke() {
    $x = func_get_args();
    return call_user_func_array($this->anonymous, $x);

$a = new Lambda(function($x) {
  return $x*$x;

$y = $a(5);
echo "$y\n";

If one implemented the ArrayAccess interface, one could create objects that as extensible as JavaScript objects.

Example Code

There are more examples for one to peruse over at my github account. Here are the links to the gists:

  1. Composing Functions in PHP
  2. Sketch of Making a Functional Style Controller (Please, don’t emulate this! This is terrible, I have a better way of doing it in the works.)
  3. Functional Programming in PHP

Digital Detritus

Entropic flotsam, digital detritus, cyber cruft, binary bullshit, whatever you call it: It’s astoundingly annoying. It pervades cyberspace. One finds it on a Facebook wall, following oneself on Twitter, and in a MySpace inbox. It even manages to find it’s way past the guard of spam filters and into your inbox. Most sinisterly, it is the result of well meaning friends using a digital good and leaving little reproducing wrappers all over the place.

I define digital detritus as a trail of digital litter created by the consumption of digital goods/apps — akin to a candy wrapper left behind after the candy’s consumption.

Of course, no one ever pauses to think that posting digital detritus to a friends wall might be just like taking the flavorless gum in your mouth and sticking it to your friend’s house wall, using the wrapper to cover it up and provide advertisement for the good you just consumed. If you don’t want a sticky mess on your wall, there is no option to instantly make all walls Teflon. It still introduces a burden of having to clean up after people. It takes one’s private wall and makes it public.

Public spaces tend to get less respect from certain people. People stick gum under tables. People write on walls. People draw great works of graffiti. People have raging debates in some coffee shops. People post events on the announcement boards. Companies advertise on billboards. Most things we are accustomed to these days are brought to you by marketing. Somehow marketing has managed to make it beyond your magazines, television screens, and margins of your computer screens, and onto the walls of your virtual edifice. Public spaces were meant for this, but my wall? Maybe an Andy Warhol print of a Campbell’s soup can, but that’s it.

In Facebook’s case, there are settings to keep anyone from posting to your wall. What if you want friends to be able to still have conversations within your virtual walls? You can’t just turn off apps. That is true in at least two aspects: 1) You really can’t, there’s not setting for it. 2) If you did, friends using a client like HootSuite or TweetDeck couldn’t post to your wall either.

Some games are geared towards growing their user base — this is really the only way for them to continually make more money and grow. I don’t know if “social gaming” should have ever been manipulated into requiring one to get more and more friends playing the game in order to advance game play. That’s not gaming, that’s Amway or some other pyramid scheme. If you do play these “social” games that want you to post random advertisements to your friends wall, I hope you reconsider what games you play in your spare time (and good luck posting to my wall, I’ve blocked all posts).

I want to look forward to a world that has less digital detritus to clean up. I want to see more truly social games that don’t encourage wasted bits, but rather epic game play and great challenges in order to advance. I imagine people might pay for that. I demand better!

Documentation for gRaphael: g.line.js

Update: I found another library that is superior to gRaphael. It’s called Ico by Alex Young. You can find it here: http://alexyoung.github.com/ico/. It doesn’t support all of the graph types, but the options more thorough.

gRaphael provides an easy way of creating charts through JavaScript. Unfortunately, many people have complained about how poorly it is documented. In the interest of seeing more good looking charts on websites, I decided to go through the code and post documentation here. This first post is on the line chart library, but I will be posting more on the rest of the library in the future.

To start using the line chart, we need to include the Raphael and the line chart library:

<script src="/script/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="/script/g.raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="/script/g.line.js" type="text/javascript" charset="utf-8"></script>

Then initialize the chart by passing in the options to the constructor:

var r = Raphael("element");
r.g.linechart(x_offset, y_offset, width, height, x_values_array, y_values_array, options);

x_values_array is either an array of x values, or an array of multiple arrays of x values.
y_values_array is the same as above, but for the y-axis.
If only one array of x values is specified, multiple y value arrays will share these values. If both are specified, each plot will be completely independent of each other.

options is an object with the following possible elements:

var options = {
  gutter: 10,
  symbol: "",
  colors: Raphael.fn.g.colors,
  nostroke: false,
  smooth: false;
  shade: false,
  dash: "",
  axis: "",
  axisxstep: 1,
  axisystep: 1

options.gutter is the default spacing between the edge of the chart area and the graph itself.

options.symbol is either a single symbol or an array of multiple symbols for each line. Just leaving it as a blank (“”) means that it will be a line graph without any decoration at the points. The list of allowable options is:

"" - no symbol
"o" - "disc"
"f" - "flower"
"d" - "diamond"
"s" - "square"
"t" - "triangle"
"*" - "star"
"x" - "cross"
"+" - "plus"
"->"; - "arrow"

options.colors must be an array, even if there is only one line.

options.nostroke controls the line drawing. Set to false (default), it will draw the line. If this is set to true and a symbol is chosen, a scatter type plot can be made.

options.smooth turns on smoothing. No jagged angles will be seen, just smooth curves.

options.shade controls shading the area below the line. No shading happens by default. Set this to true to create an area chart.

options.dash sets the ‘stroke-dasharray’ property on the line element. According to the SVG spec:

‘stroke-dasharray’ controls the pattern of dashes and gaps used to stroke paths. Contains a list of comma and/or white space separated integers that specify the lengths of alternating dashes and gaps. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. Thus, stroke-dasharray: 5,3,2 is equivalent to stroke-dasharray: 5,3,2,5,3,2.

options.axis is a comma or space separated list of axes to show. Seems like it follows the order of css lists: top, right, bottom, left.

option.axisxstep determines how far apart the ticks and axis numbers are placed.

option.axisystep is the same as above, but for the y-axis.

Unfortunately, this is as far as the axis customization goes. I’ve been looking at the parent object and it looks like it wouldn’t be hard to customize the axes further. I’ll post more on this as I figure it out. If anyone wants to look at the g.axis() function and figure out how to add labels and customize the labels on the axis, please let me know what you find.

r.g.linechart() returns a chart object:

chart = {lines, shades, symbols, axis, columns, dots};

That chart object has the following default functions. All of these are overridable.

chart.hoverColumn = function (fin, fout) {
  !columns && createColumns();
  return this;

chart.clickColumn = function (f) {
  !columns && createColumns();
  return this;

chart.hrefColumn = function (cols) {
  var hrefs = that.raphael.is(arguments[0], "array") ? arguments[0] : arguments;
  if (!(arguments.length - 1) && typeof cols == "object") {
    for (var x in cols) {
      for (var i = 0, ii = columns.length; i < ii; i++) if (columns[i].axis == x) {
        columns[i].attr("href", cols[x]);
  !columns && createColumns();
  for (i = 0, ii = hrefs.length; i < ii; i++) {
    columns[i] && columns[i].attr("href", hrefs[i]);
  return this;

chart.hover = function (fin, fout) {
  !dots && createDots();
  return this;

chart.click = function (f) {
  !dots && createDots();
  return this;

chart.each = function (f) {
  return this;

chart.eachColumn = function (f) {
  return this;