Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A doodle in PHP
<?php
function word_live_as_one($imagination) {
global $world;
foreach ($imagination as $thought) {
switch ($thought) {
case 'heaven':
case 'hell':
case 'countries':
case 'possessions':
$dreamer = FALSE;
break;
default:
$dreamer = TRUE;
}
if (in_array($thought, $world->things_to_die_for) || (in_array($thought, $world->things_to_kill_for)) {
$dreamer = FALSE;
}
if (in_array($thought, $world->need_for_greed) || (in_array($thought, $world->need_for_hunger)) {
$dreamer = FALSE;
}
}
if ($dreamer == 'FALSE') {
echo "I hope some day you'll join us";
}
else {
$imagination = array(
'people living for today',
'people living life in peace',
'people sharing all the world',
);
}
return $imagination;
}
?>
@BurningDog

This gist opens up the possibility that imagination can be anything you want it to be. It could be one thing or many things. Heck, it can even be nothing, and you'll still get something back. The only thing you've got to do is show up, and call the function. Even empty hands can create something, and therefore entropy is not inevitable.

The author is obviously quite idealistic, for although he seems to allow for checking if things to die for are in the passed imagination, $things_to_die_for is never instantiated with any value. Perhaps this could be a function call, but we'd need to find a way to dynamically generate its user-specific values (perhaps with some investigation of their social media account?), since things to die for are not universal. However, if a philosophical statement agreeing with this generalization were to be made, then instead of using a function we could use a global variable, implying that everyone wants to die and kill for the same things. This is obviously false, and using globals are bad anyway.

An argument could be made for the globalization of $need_for_greed = FALSE; and $need_for_hunger = FALSE; In a subversive way, this use of globals would improve the world, albeit to the consternation of good programming practice. The question is then posed: what is better - good programming practice or solving world hunger? An ideal approach would be to find a solution in which these two (good) things are not opposed, perhaps by retrieving the values of the variables from the UN Millennium Development Goals website.

@asciikewl

That is SOOOO pretty :)

Some thoughts:

if (isset($immagination)) {
unset($possessions,$greed,$hunger);
}

if (in_array($me,$dreamers)) {
print count($dreamers);
}

if (in_array($you,$dreamers) && brotherhood($man)) {
global $world;
live_as_one($world);
}

@xsyn
xsyn commented May 16, 2013

I see no reason to unset the variables that are never set. I also think that $imagination is is not unaligned with $greed, $hunger, $possessions.

I think you should they should be unset as a function of the world living as one. So thinking this through:

I would call the top level function image, which you are then passing the things which should be imagined.

Thoughts?

@xsyn
xsyn commented May 16, 2013

On further reflection, you probably want a recursive function in some functional language. But….

@perceptum

xsyn++

This is very cool though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment